kafka消费后连接zookeeper出错,大神进来看看指点下呗。

pangu5 2016-10-23 04:36:09

kafka消费者能正常消费,能从kafka集群中取到数据,消费者的逻辑是这样的。

KafkaStream<byte[], byte[]> streamt = consumerMap.get(topic).get(0);
ConsumerIterator<byte[], byte[]> it = streamt.iterator();
while (it.hasNext())
System.out.println(new String(it.next().message()));

// now launch all the threads
executor = Executors.newFixedThreadPool(numThreads);

// now create an object to consume the messages
//
int threadNumber = 0;
for (final KafkaStream stream : streams) {
executor.submit(new ConsumerMsgTask(stream, threadNumber));
threadNumber++;
}
}

但是全部数据消费完之后,再执行到 while (it.hasNext())时,就会出现这个问题:

2016-10-23 16:36:04 [main-SendThread(localhost:2181):1414357] - [DEBUG] Got ping response for sessionid: 0x157f072a16d000f after 0ms
2016-10-23 16:36:07 [main-SendThread(localhost:2181):1417025] - [DEBUG] Got ping response for sessionid: 0x157f072a16d000f after 1ms
2016-10-23 16:36:10 [main-SendThread(localhost:2181):1419692] - [DEBUG] Got ping response for sessionid: 0x157f072a16d000f after 1ms
2016-10-23 16:36:12 [main-SendThread(localhost:2181):1422359] - [DEBUG] Got ping response for sessionid: 0x157f072a16d000f after 1ms

而且每隔1秒打印一次这个,程序不往下进行了。 是不是kafka连不上zookeeper呢 ?

大神们帮忙看看啊,,。。这个不知道怎么解决了。。
...全文
2113 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
鲁邦 2016-11-28
  • 打赏
  • 举报
回复
貌似你的log4j log 级别设的是DEBUG,调高点就好了。

932

社区成员

发帖
与我相关
我的任务
社区描述
云计算 云存储相关讨论
社区管理员
  • 云存储
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧