我的Kafka消费者无法阅读来自制作人的消息。
$ jps
31700 Kafka
11243 Jps
31517 QuorumPeerMain
向制作人提供主题:
编辑前:
$ bin/kafka-console-producer.sh --broker-list localhost:9092 --topic Hello_Kafka
this is my 1st message
this is my 2nd message
修改后:
$ bin/kafka-console-producer.sh --broker-list localhost:9092 --topic Hello-Kafka
this is my 1st message
this is my 2nd message
打开另一个终端并尝试从消费者那里读取数据:
$ bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic Hello-Kafka --from-beginning
在此之后,我在终端上看不到任何消息。
这些是一些可能有助于调试的日志:
$ [2017-02-20 08:23:15,000] INFO Expiring session 0x15a49f1f2530020, timeout of 30000ms exceeded (org.apache.zookeeper.server.ZooKeeperServer)
[2017-02-20 08:23:15,000] INFO Expiring session 0x15a49f1f2530022, timeout of 30000ms exceeded (org.apache.zookeeper.server.ZooKeeperServer)
[2017-02-20 08:23:15,000] INFO Expiring session 0x15a49f1f2530021, timeout of 30000ms exceeded (org.apache.zookeeper.server.ZooKeeperServer)
[2017-02-20 08:23:15,000] INFO Processed session termination for sessionid: 0x15a49f1f2530020 (org.apache.zookeeper.server.PrepRequestProcessor)
[2017-02-20 08:23:15,000] INFO Processed session termination for sessionid: 0x15a49f1f2530022 (org.apache.zookeeper.server.PrepRequestProcessor)
[2017-02-20 08:23:15,001] INFO Processed session termination for sessionid: 0x15a49f1f2530021 (org.apache.zookeeper.server.PrepRequestProcessor)
[2017-02-20 08:26:48,764] INFO Accepted socket connection from /127.0.0.1:45806 (org.apache.zookeeper.server.NIOServerCnxnFactory)
[2017-02-20 08:26:48,766] INFO Client attempting to establish new session at /127.0.0.1:45806 (org.apache.zookeeper.server.ZooKeeperServer)
[2017-02-20 08:26:48,768] INFO Established session 0x15a49f1f2530024 with negotiated timeout 30000 for client /127.0.0.1:45806 (org.apache.zookeeper.server.ZooKeeperServer)
[2017-02-20 08:26:48,778] INFO Accepted socket connection from /127.0.0.1:45808 (org.apache.zookeeper.server.NIOServerCnxnFactory)
[2017-02-20 08:26:48,778] INFO Client attempting to establish new session at /127.0.0.1:45808 (org.apache.zookeeper.server.ZooKeeperServer)
[2017-02-20 08:26:48,779] INFO Established session 0x15a49f1f2530025 with negotiated timeout 30000 for client /127.0.0.1:45808 (org.apache.zookeeper.server.ZooKeeperServer)
[2017-02-20 08:26:48,783] INFO Accepted socket connection from /127.0.0.1:45810 (org.apache.zookeeper.server.NIOServerCnxnFactory)
[2017-02-20 08:26:48,783] INFO Client attempting to establish new session at /127.0.0.1:45810 (org.apache.zookeeper.server.ZooKeeperServer)
[2017-02-20 08:26:48,784] INFO Established session 0x15a49f1f2530026 with negotiated timeout 30000 for client /127.0.0.1:45810 (org.apache.zookeeper.server.ZooKeeperServer)
[2017-02-20 08:26:48,865] INFO Accepted socket connection from /127.0.0.1:45812 (org.apache.zookeeper.server.NIOServerCnxnFactory)
[2017-02-20 08:26:48,865] INFO Client attempting to establish new session at /127.0.0.1:45812 (org.apache.zookeeper.server.ZooKeeperServer)
[2017-02-20 08:26:48,867] INFO Established session 0x15a49f1f2530027 with negotiated timeout 6000 for client /127.0.0.1:45812 (org.apache.zookeeper.server.ZooKeeperServer)
[2017-02-20 08:26:48,930] INFO Got user-level KeeperException when processing sessionid:0x15a49f1f2530027 type:create cxid:0x2 zxid:0xa9 txntype:-1 reqpath:n/a Error Path:/consumers Error:KeeperErrorCode = NodeExists for /consumers (org.apache.zookeeper.server.PrepRequestProcessor)
[2017-02-20 08:27:50,978] INFO [Group Metadata Manager on Broker 0]: Removed 0 expired offsets in 0 milliseconds. (kafka.coordinator.GroupMetadataManager)