在 Storm 拓扑上配置集群 ZK_HOST
Config cluster ZK_HOST on Storm Topology
现在我刚刚在单台机器上成功地设置了单节点的风暴拓扑。我使用 KafkaSpout 如下:
String zkHostPort = "localhost:2181";
String topic = "sentences";
String zkRoot = "/kafka-sentence-spout";
String zkSpoutId = "sentence-spout";
ZkHosts zkHosts = new ZkHosts(zkHostPort);
SpoutConfig spoutCfg = new SpoutConfig(zkHosts, topic, zkRoot, zkSpoutId);
KafkaSpout kafkaSpout = new KafkaSpout(spoutCfg);
return kafkaSpout;
现在我搭建了集群zookeeper(三节点:server1.com:2181,server2.com:2181.server3.com:2181)和集群kafka(三节点)。我想知道如何为此更改 Storm Topology 上的代码。请帮帮我!!
请使用以下配置:
String zkHostPort = "server1.com:2181,server2.com:2181,server3.com:2181";
String topic = "sentences";
String zkRoot = "/kafka-sentence-spout";
String zkSpoutId = "sentence-spout";
ZkHosts zkHosts = new ZkHosts(zkHostPort);
SpoutConfig spoutCfg = new SpoutConfig(zkHosts, topic, zkRoot, zkSpoutId);
KafkaSpout kafkaSpout = new KafkaSpout(spoutCfg);
return kafkaSpout;
注意:这里最常见的问题是space放在逗号后的主机之间,主机之间不能有space。
正确:
server1.com:2181,server2.com:2181,server3.com:2181
错误:
server1.com:2181, server2.com:2181, server3.com:2181
现在我刚刚在单台机器上成功地设置了单节点的风暴拓扑。我使用 KafkaSpout 如下:
String zkHostPort = "localhost:2181";
String topic = "sentences";
String zkRoot = "/kafka-sentence-spout";
String zkSpoutId = "sentence-spout";
ZkHosts zkHosts = new ZkHosts(zkHostPort);
SpoutConfig spoutCfg = new SpoutConfig(zkHosts, topic, zkRoot, zkSpoutId);
KafkaSpout kafkaSpout = new KafkaSpout(spoutCfg);
return kafkaSpout;
现在我搭建了集群zookeeper(三节点:server1.com:2181,server2.com:2181.server3.com:2181)和集群kafka(三节点)。我想知道如何为此更改 Storm Topology 上的代码。请帮帮我!!
请使用以下配置:
String zkHostPort = "server1.com:2181,server2.com:2181,server3.com:2181";
String topic = "sentences";
String zkRoot = "/kafka-sentence-spout";
String zkSpoutId = "sentence-spout";
ZkHosts zkHosts = new ZkHosts(zkHostPort);
SpoutConfig spoutCfg = new SpoutConfig(zkHosts, topic, zkRoot, zkSpoutId);
KafkaSpout kafkaSpout = new KafkaSpout(spoutCfg);
return kafkaSpout;
注意:这里最常见的问题是space放在逗号后的主机之间,主机之间不能有space。
正确:
server1.com:2181,server2.com:2181,server3.com:2181
错误:
server1.com:2181, server2.com:2181, server3.com:2181