我有一个 Storm 拓扑,其中使用 KafkaSpout
。
BrokerHosts zk = new ZkHosts("localhost:2181");
SpoutConfig spoutConf = new SpoutConfig(zk, "topic", "/topic", "discovery");
我想知道在 SpoutConfig
中传递的第三个和第四个参数。
第三个参数是安装Zookeeper的Zookeeper根路径还是
dataDir
路径?第四个参数是一个ID,但我不知道为什么使用它以及我应该提供什么?
最佳答案
zkRoot和id用于构造zookeeper路径,storm在该路径下存储kafka偏移量。您可以阅读here .
The spout stores the state of the offsets its consumed in Zookeeper. The spout is parameterized with the root path to store the offsets and an id for this particular spout. So offsets for partitions will be stored in these paths, where "0", "1" are ids for the partitions:
{root path}/{id}/0
{root path}/{id}/1
{root path}/{id}/2
{root path}/{id}/3
...
关于java - 定义 SpoutConfig 参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31403890/