storm 启动
- 行业动态
- 2023-11-13
- 1
在Storm中,启动类是用于初始化和配置Storm集群的类,它通常包含一些必要的设置,如定义拓扑、设置工作目录、配置Nimbus和Supervisor等,下面是一个典型的Storm启动类的示例:
“`java
import backtype.storm.Config;
import backtype.storm.LocalCluster;
import backtype.storm.topology.TopologyBuilder;
import backtype.storm.tuple.Fields;
import backtype.storm.utils.Utils;
public class StormStarter {
public static void main(String[] args) {
// 创建拓扑构建器
TopologyBuilder builder = new TopologyBuilder();
// 定义拓扑组件
builder.setSpout(“spout”, new MySpout(), 1);
builder.setBolt(“bolt”, new MyBolt(), 2).shuffleGrouping(“spout”);
// 设置拓扑的配置
Config conf = new Config();
conf.setDebug(true);
conf.setNumWorkers(2);
conf.setMaxSpoutPending(1);
conf.setMaxBoltPending(1);
conf.setMessageTimeoutSecs(30);
conf.setDebugActions(“*”);
conf.setDebugOutputToStdOut(true);
conf.setDebugSuppressLogging(false);
conf.setDebugSuppressTimeStamp(false);
conf.setDebugSuppressExceptionStackTrace(false);
conf.setDebugSuppressRecursiveErrorDetails(false);
conf.setDebugSuppressDirectObjectInspection(false);
conf.setDebugSuppressClassLoadingDetails(false);
conf.setDebugSuppressFieldAccessDetails(false);
conf.setDebugSuppressMethodExecutionDetails(false);
conf.setDebugSuppressExceptionDetails(false);
conf.setDebugSuppressStackTrace(false);
conf.setDebugSuppressExceptionCause(false);
conf.setDebugSuppressExceptionClass(false);
conf.setDebugSuppressExceptionMessage(false);
conf.setDebugSuppressExceptionMessage
本站发布或转载的文章及图片均来自网络,其原创性以及文中表达的观点和判断不代表本站,有问题联系侵删!
本文链接:http://www.xixizhuji.com/fuzhu/339587.html