kafka使用者无法使用引导服务器名称来使用消息

ebdffaop  于 2021-06-07  发布在  Kafka
关注(0)|答案(1)|浏览(374)

我在使用引导服务器(即kafka服务器)使用消息时遇到了一个问题。你知道为什么没有zookeeper它不能使用消息吗?
Kafka版本:Kafka2.11-1.0.0
zookeeper版本:Kafka2.11-1.0.0
zookeeper主机和端口:zkp02.mp。com:2181
Kafka主机和端口:kfk03.mp。com:9092
产生一些信息:

[kfk03.mp.com ~]$ /bnsf/kafka/bin/kafka-console-producer.sh --broker-list kfk03.mp.com:9092 --topic test
>hi
>hi

如果我给出 –-bootstrap-server :

[kfk03.mp.com ~]$
/bnsf/kafka/bin/kafka-console-consumer.sh --bootstrap-server kfk03.mp.com:9092 --topic test --from-beginning

消费者能够在 --zookeeper 提供服务器而不是 --bootstrap-server -:

[kfk03.mp.com ~]$ /bnsf/kafka/bin/kafka-console-consumer.sh --zookeeper zkp02.mp.com:2181 --topic test --from-beginning

Using the ConsoleConsumer with old consumer is deprecated and will be removed in a future major release. Consider using the new consumer by passing [bootstrap-server] instead of [zookeeper].

{"properties": {"messageType": "test", "sentDateTime": "2018-02-25T21:46:00.000+0000"}, "name": "Uttam Anand", "age": 29}
{"properties": {"messageType": "test", "sentDateTime": "2018-02-25T21:46:00.000+0000"}, "name": "Uttam Anand", "age": 29}
{"properties": {"messageType": "test", "sentDateTime": "2018-02-25T21:46:00.000+0000"}, "name": "Uttam Anand", "age": 29}
hi
{"properties": {"messageType": "test", "sentDateTime": "2018-02-25T21:46:00.000+0000"}, "name": "Uttam Anand", "age": 29}
{"properties": {"messageType": "test", "sentDateTime": "2018-02-25T21:46:00.000+0000"}, "name": "Uttam Anand", "age": 29}
{"properties": {"messageType": "test", "sentDateTime": "2018-02-25T21:46:00.000+0000"}, "name": "Uttam Anand", "age": 29}
{"properties": {"messageType": "test", "sentDateTime": "2018-02-25T21:46:00.000+0000"}, "name": "Uttam Anand", "age": 29}
{"properties": {"messageType": "test", "sentDateTime": "2018-02-25T21:46:00.000+0000"}, "name": "Uttam Anand", "age": 29}
hi
hi
uttam
hi
hi
hi
hello
hi
^CProcessed a total of 17 messages
rslzwgfq

rslzwgfq1#

当使用bootstrap server参数使用来自kafka的消息时,连接通过kafka服务器而不是zookeeper进行。kafka broker将补偿详细信息存储在\uu consumer\u offsets主题中。
检查主题列表中是否存在消费偏移量。如果它不在那里,检查Kafka日志以找出原因。
我们面临着类似的问题。在本例中,由于以下错误,未创建\uu消费者\u偏移:

ERROR [KafkaApi-1001] Number of alive brokers '1' does not meet the required replication factor '3' for the offsets topic (configured via 'offsets.topic.replication.factor').

相关问题