storm 入门介绍(持续更新)

storm的集群表面上看和hadoop的集群非常像。但是在Hadoop上面你运行的是MapReduce的Job, 而在Storm上面你运行的是Topology。
它们是非常不一样的 — 一个关键的区别是: 一个MapReduce Job最终会结束, 而一个Topology运永远运行(除非你显式的杀掉他)。

        Config conf = new Config();

        //设置work的数量
        conf.setNumWorkers(2);

        //设置Excutor的数量
        TopologyBuilder topologyBuilder = new TopologyBuilder();
        topologyBuilder.setBolt("blue-spout", new BlueSpot(), 2);
        topologyBuilder.setBolt("green-bolt", new GreenBolt(), 2).setNumTasks(4).shuffleGrouping("blue-spout");
        topologyBuilder.setBolt("yellow-bolt", new YellowBolt(), 6).shuffleGrouping("green-bolt");

 命令行重新设置进程和线程个数

//Reconfigure the topology "test" to use 5 worker processes
//the spout "blue-spout to use 3 executors and the bolt "yellow-bolt" to use 10 executors."
        
storm rebalance test -n 5 -e blue-spout=3 -e yellow-bolt=10

参考链接

1 storm 原理简介及单机版安装指南  https://my.oschina.net/leejun2005/blog/147607?from=20130804#OSC_h2_1

2 入门源码            https://github.com/nathanmarz/storm-starter

原文地址:https://www.cnblogs.com/hdu-2010/p/7650648.html