当前位置: 首页 > 知识库问答 >
问题:

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

韦欣德
2023-03-14
    null

产生一些消息:

[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

共有1个答案

谢俊力
2023-03-14

当使用bootstrap-server参数从kafka获取消息时,连接通过kafka服务器而不是Zookeeper进行。Kafka broker在__consumer_offsets主题中存储偏移量详细信息。

检查主题列表中是否存在__consumer_offsets。如果不在,就去查Kafaka的日志找原因。

我们也面临类似的问题。在我们的示例中,由于以下错误,没有创建__consumer_offsets:

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').
 类似资料:
  • 我使用的是spring-kafka 2.1.10.release。我有一个拥有next属性的消费者(复制了几乎所有的属性): 我生产的Apache Kafka版本是2.11-1.0.0-0pan4。有一个集群内部有3个kafka的节点: 甚至无法在本地复制。事情是这样的: 4)最神秘:在应用程序中,一切都可以工作。Spring-consumer读取新消息并将它们发送给kafka。我看到了这样的日志

  • 我已经开发了一个使用apache storm使用kafka消息的应用程序,当我在eclipse中运行topology using in LocalCluster时,它可以正常工作,消息也可以正常使用,但是当我使用storm命令(bin\storm jar..\kafka-storm-0.0.1-SNAPSHOT.jar com.kafka_storm.util.topology storm kaf

  • 我们正在使用与Kafka消费者和生产者Spring。我们正在生成大小为905字节的消息。我们正在序列化消息,并试图为下一个使用者反序列化它。 消息有效负载类示例: Application.Properties 当我们接受字符串格式的消息负载时,Consumer工作得很好,但当我们将Consumer中的负载反序列化为对象时,我们面临着问题。下面的错误被抛出相同

  • 因为我是新的Kafka,所以我能够从文件中读取记录,并通过生产者将消息发送到Kafka主题,但不能通过消费者消费相同的主题。 注意:您可以从任何文本文件中读取数据,我使用的是Kafka2.11-0.9。0.0版本 这是我的密码: 下面是输出:

  • 问题内容: 我正在尝试创建一个群集以将消息发送到远程控制。我已经按照此处所述配置了所有内容。我正在机器上运行它,并且使用shell可以正常工作。在Windows计算机上按照教程中的说明编写Java代码后,我收到以下错误: 我也尝试在其他Linux机器上运行jar,但仍然收到相同的错误。 可以在安装kafka的计算机中将地址更改为jar并在其中运行Java代码。 我相信它与配置有关,但是找不到。 问