1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 01 TopologyBuilder builder = new TopologyBuilder(); 02 03 builder.setSpout("spout", new RandomSentenceSpout(), 5); 04 05 builder.setBolt("map", new SplitSentence(), 4) 06 .shuffleGrouping("spout"); 07 08 builder.setBolt("reduce", new WordCount(), 8) 09 .fieldsGrouping("map", new Fields("word")); 10 11 Config conf = new Config(); 12 conf.setDebug(true); 13 14 LocalCluster cluster = new LocalCluster(); 15 cluster.submitTopology("word-count", conf, builder.createTopology()); 16 17 Thread.sleep(10000); 18 19 cluster.shutdown(); |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |