kafka消费者发消息失败

报错如下

./kafka-console-producer.sh --broker-list 容器ip:9092 --topic testTopic
>1
[2020-04-01 01:42:01,606] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 1 : {testTopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2020-04-01 01:42:01,698] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 2 : {testTopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2020-04-01 01:42:01,812] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 3 : {testTopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2020-04-01 01:42:01,921] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 4 : {testTopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2020-04-01 01:42:02,029] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 5 : {testTopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2020-04-01 01:42:02,152] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 6 : {testTopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2020-04-01 01:42:02,260] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 7 : {testTopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2020-04-01 01:42:02,374] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 8 : {testTopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2020-04-01 01:42:02,481] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 9 : {testTopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2020-04-01 01:42:02,594] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 10 : {testTopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2020-04-01 01:42:02,704] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 11 : {testTopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2020-04-01 01:42:02,811] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 12 : {testTopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2020-04-01 01:42:02,923] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 13 : {testTopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2020-04-01 01:42:03,037] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 14 : {testTopic=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
^Corg.apache.kafka.common.KafkaException: Producer closed while send in progress
    at org.apache.kafka.clients.producer.KafkaProducer.doSend(KafkaProducer.java:888)
    at org.apache.kafka.clients.producer.KafkaProducer.send(KafkaProducer.java:865)
    at kafka.tools.ConsoleProducer$.send(ConsoleProducer.scala:75)
    at kafka.tools.ConsoleProducer$.main(ConsoleProducer.scala:57)
    at kafka.tools.ConsoleProducer.main(ConsoleProducer.scala)
Caused by: org.apache.kafka.common.KafkaException: Requested metadata update after close
    at org.apache.kafka.clients.producer.internals.ProducerMetadata.awaitUpdate(ProducerMetadata.java:104)
    at org.apache.kafka.clients.producer.KafkaProducer.waitOnMetadata(KafkaProducer.java:1029)
    at org.apache.kafka.clients.producer.KafkaProducer.doSend(KafkaProducer.java:885)
    ... 4 more
解决办法:

修改server.properties文件

在这两个地方加上容器ip

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值