我尝试通过SimpleConsumer连接到远程kafka zookeeper(.page
),并为我已指定的主题提取元数据。但是,我收到了这个错误:
zookeeperhost:1234
我运行telnet zookeeperhost 1234并获得以下内容:
RunnerMain failed :java.io.EOFException: Received -1 when reading from channel, socket has likely been closed.
所以看起来我能够访问该服务,没有安全/许可问题。
这是我的代码:
Trying <ip addr of host>...
Connected to zookeeperhost.somedomain.com.
Escape character is '^]'.
答案 0 :(得分:4)
您需要将SimpleConsumer连接到kafka领导者代理(默认情况下为端口9092)而不是zookeeper。查看此链接以获取有关如何使用SimpleConsumer的详细信息:https://cwiki.apache.org/confluence/display/KAFKA/0.8.0+SimpleConsumer+Example