Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache kafka 如何首次使用apache kafka集成部署storm core拓扑?_Apache Kafka_Apache Storm - Fatal编程技术网

Apache kafka 如何首次使用apache kafka集成部署storm core拓扑?

Apache kafka 如何首次使用apache kafka集成部署storm core拓扑?,apache-kafka,apache-storm,Apache Kafka,Apache Storm,我想获得有关ApacheStorm和kafka初始设置的帮助 我能够将拓扑提交给storm群集,但在storm ui中出现以下错误 下面是我的代码片段 // Kafka consumer client depends on Zookeeper when finding kafka nodes. // Zookeeper Host List String zkConnString = "localhost:2181"; String brokerZkPath = "/kafka-cluster-1

我想获得有关ApacheStorm和kafka初始设置的帮助

我能够将拓扑提交给storm群集,但在storm ui中出现以下错误

下面是我的代码片段

// Kafka consumer client depends on Zookeeper when finding kafka nodes.
// Zookeeper Host List
String zkConnString = "localhost:2181";
String brokerZkPath = "/kafka-cluster-1/brokers";
String zkRoot       = "/kafka-cluster-1/brokers/topics";
String topicName    = "myfirsttopic";

/* ****************************************************************** */
/* Topology configuration variable                                    */
/* ****************************************************************** */
/* the number of tasks that should be assigned to execute this bolt   */
Integer boltParalismHint  = 1;
Integer spoutParalismHint = 1;

/* ****************************************************************** */
/* Build kafka consumer spout                                         */
/* ****************************************************************** */
// Build zookeeper instance
BrokerHosts hosts = new ZkHosts( zkConnString, brokerZkPath );

// Build configuration instance for Spout
SpoutConfig spoutConfig = new SpoutConfig( hosts, topicName, zkRoot + "/" + topicName , UUID.randomUUID().toString() );

spoutConfig.ignoreZkOffsets = true;

// Build Multischeme instance
spoutConfig.scheme = new SchemeAsMultiScheme( new StringScheme() );

// Build Kafka spout
KafkaSpout kafkaSpout = new KafkaSpout(spoutConfig);
我已经引用了,并将IgnorezkOffset设置为true

如果要强制喷口忽略任何消费状态 存储在ZooKeeper中的信息,那么您应该设置参数 Kafkanconfig.ignorezk偏移为true

然而,从日志上看,卡夫卡喷口似乎正在读取Zookeeper的偏移量

由于这是一个初始设置,我如何停止从Zookeeper读取风暴偏移量

我使用以下版本

  • apache storm 1.2.1
  • 阿帕奇·卡夫卡·卡夫卡2.12-1.1.0

我没有做任何特殊操作,但在以下情况下,错误似乎不会出现在storm ui中

  • 在卡夫卡中创建主题
  • 确保Zookeeper中存在brokerZkPath(到brokers目录的路径。在我的例子中是/kafka-cluster-1/brokers)
  • 确保Zookeeper中存在zkRootPath(topics目录的路径。在我的例子中是/kafka-cluster-1/brokers/topics)
  • 向storm提交拓扑

  • 你找到解决这个问题的办法了吗?我也面临同样的问题@日本指弹新人渡边郁
    // Kafka consumer client depends on Zookeeper when finding kafka nodes.
    // Zookeeper Host List
    String zkConnString = "localhost:2181";
    String brokerZkPath = "/kafka-cluster-1/brokers";
    String zkRoot       = "/kafka-cluster-1/brokers/topics";
    String topicName    = "myfirsttopic";
    
    /* ****************************************************************** */
    /* Topology configuration variable                                    */
    /* ****************************************************************** */
    /* the number of tasks that should be assigned to execute this bolt   */
    Integer boltParalismHint  = 1;
    Integer spoutParalismHint = 1;
    
    /* ****************************************************************** */
    /* Build kafka consumer spout                                         */
    /* ****************************************************************** */
    // Build zookeeper instance
    BrokerHosts hosts = new ZkHosts( zkConnString, brokerZkPath );
    
    // Build configuration instance for Spout
    SpoutConfig spoutConfig = new SpoutConfig( hosts, topicName, zkRoot + "/" + topicName , UUID.randomUUID().toString() );
    
    spoutConfig.ignoreZkOffsets = true;
    
    // Build Multischeme instance
    spoutConfig.scheme = new SchemeAsMultiScheme( new StringScheme() );
    
    // Build Kafka spout
    KafkaSpout kafkaSpout = new KafkaSpout(spoutConfig);