storm本地模式运行Local mode
storm本地模式运行Local mode
月下独酌100 发表于3年前
storm本地模式运行Local mode
  • 发表于 3年前
  • 阅读 65
  • 收藏 0
  • 点赞 0
  • 评论 0

【腾讯云】买域名送云解析+SSL证书+建站!>>>   

local mode

storm_home/bin/storm jar ../examples/storm-starter/storm-starter-topologies-0.9.2-incubating.jar storm.starter.BasicDRPCTopology

 storm_home/bin/storm jar ../examples/storm-starter/storm-starter-topologies-0.9.2-incubating.jar storm.starter.WordCountTopology

 

 cluster mode

storm_home/bin/storm jar ../examples/storm-starter/storm-starter-topologies-0.9.2-incubating.jar storm.starter.WordCountTopology WordCountTopology

 

 

Local mode

Local mode simulates a Storm cluster in process and is useful for developing and testing topologies. Running topologies in local mode is similar to running topologies on a cluster.

To create an in-process cluster, simply use the LocalCluster class. For example:

```java import backtype.storm.LocalCluster;

LocalCluster cluster = new LocalCluster(); ```

You can then submit topologies using the submitTopology method on the LocalCluster object. Just like the corresponding method on StormSubmitter, submitTopology takes a name,

 a topology configuration, and the topology object. You can then kill a topology using the killTopology method which takes the topology name as an argument.

To shutdown a local cluster, simple call:

java cluster.shutdown();

Common configurations for local mode

You can see a full list of configurations here.

Config.TOPOLOGY_MAX_TASK_PARALLELISM: This config puts a ceiling on the number of threads spawned for a single component. Oftentimes production topologies have a lot of parallelism (hundreds of threads) which places unreasonable load when trying to test the topology in local mode. This config lets you easy control that parallelism.

Config.TOPOLOGY_DEBUG: When this is set to true, Storm will log a message every time a tuple is emitted from any spout or bolt. This is extremely useful for debugging.


本地模式

对于开发topologies在本机进行测试很有用。

Config.TOPOLOGY_MAX_TASK_PARALLELISM参数可以限制进程内开的线程数量的上限。


  • 打赏
  • 点赞
  • 收藏
  • 分享
共有 人打赏支持
粉丝 25
博文 186
码字总数 56475
×
月下独酌100
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: