我设置了一个具有1个分区和1个复制因子的Kafka代理。
我可以产生消息,但是我不能使用它们。我没有收到任何错误,就像正在等待什么一样。
我正在尝试使用以下命令消耗它们:
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic my-kafka-topic --from-beginning
Kafka配置
broker.id=1
listeners = PLAINTEXT://:9092
log.dirs=/tmp/kafka_1-logs
Zookeeper日志(最新消息)
[2019-11-04 22:49:28,859] INFO Accepted socket connection from /0:0:0:0:0:0:0:1:56069 (org.apache.zookeeper.server.NIOServerCnxnFactory)
[2019-11-04 22:49:28,860] INFO Client attempting to establish new session
at /0:0:0:0:0:0:0:1:56069 (org.apache.zookeeper.server.ZooKeeperServer)
[2019-11-04 22:49:28,990] INFO Established session 0x1000baf48760002 with
negotiated timeout 6000 for client /0:0:0:0:0:0:0:1:56069 (org.apache.zookeeper.server.ZooKeeperServer)
[2019-11-04 22:49:29,246] INFO Got user-level KeeperException when processing sessionid:0x1000baf48760002 type:multi cxid:0xc5 zxid:0x25e txntype:-1 reqpath:n/a aborting remaining multi ops. Error Path:/admin/preferred_replica_election Error:KeeperErrorCode = NoNode for /admin/preferred_replica_election (org.apache.zookeeper.server.PrepRequestProcessor)
制作人
$ bin/kafka-console-producer.sh --broker-list localhost:9092 --topic my-kafka-topic
>hello
>howdy
>121
>
PS 我正在关注这个guide
更新
我正在先创建主题。如果我不这样做,则尝试发布一条消息,并显示错误消息LEADER UNAVAILABLE
我检查了日志,从尝试使用该消息开始,服务器日志中没有任何内容。与此同时,终端无限期地等待。
Controller.log
> [2019-11-05 23:30:01,118] DEBUG [Controller id=1] Topics not in
> preferred replica for broker 0 Map()
> (kafka.controller.KafkaController) [2019-11-05 23:30:01,118] TRACE
> [Controller id=1] Leader imbalance ratio for broker 0 is 0.0
> (kafka.controller.KafkaController)