kafka入门1-集群生产消息 报:ERROR Producer connection to localhost:9092 unsuccessful

转载 2015年07月08日 18:12:09

./kafka-console-producer.sh --broker-list localhost:9092 --topic topic1,报下面的错

[2014-12-02 14:16:21,565] ERROR Producer connection to localhost:9092 unsuccessful (kafka.producer.SyncProducer)
java.net.ConnectException: Connection refused
        at sun.nio.ch.Net.connect0(Native Method)
        at sun.nio.ch.Net.connect(Net.java:465)
        at sun.nio.ch.Net.connect(Net.java:457)
        at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:670)
        at kafka.network.BlockingChannel.connect(BlockingChannel.scala:57)
        at kafka.producer.SyncProducer.connect(SyncProducer.scala:141)
        at kafka.producer.SyncProducer.getOrMakeConnection(SyncProducer.scala:156)
        at kafka.producer.SyncProducer.kafka$producer$SyncProducer

doSend(SyncProducer.scala:68)atkafka.producer.SyncProducer.send(SyncProducer.scala:112)atkafka.client.ClientUtils$.fetchTopicMetadata(ClientUtils.scala:53)atkafka.producer.BrokerPartitionInfo.updateInfo(BrokerPartitionInfo.scala:82)atkafka.producer.async.DefaultEventHandler
anonfun$handle$1.apply$mcV$sp(DefaultEventHandler.scala:67)
        at kafka.utils.Utils$.swallow(Utils.scala:167)
        at kafka.utils.Logging$class.swallowError(Logging.scala:106)
        at kafka.utils.Utils$.swallowError(Utils.scala:46)
        at kafka.producer.async.DefaultEventHandler.handle(DefaultEventHandler.scala:67)
        at kafka.producer.async.ProducerSendThread.tryToHandle(ProducerSendThread.scala:104)
        at kafka.producer.async.ProducerSendThread
anonfun$processEvents$3.apply(ProducerSendThread.scala:87)atkafka.producer.async.ProducerSendThread
anonfun$processEvents$3.apply(ProducerSendThread.scala:67)
        at scala.collection.immutable.Stream.foreach(Stream.scala:526)
        at kafka.producer.async.ProducerSendThread.processEvents(ProducerSendThread.scala:66)
        at kafka.producer.async.ProducerSendThread.run(ProducerSendThread.scala:44)
[2014-12-02 14:16:21,572] WARN Fetching topic metadata with correlation id 0 for topics [Set(topic1)] from broker [id:0,host:localhost,port:9092] failed (kafka.client.ClientUtils$)
java.net.ConnectException: Connection refused
        at sun.nio.ch.Net.connect0(Native Method)
        at sun.nio.ch.Net.connect(Net.java:465)
        at sun.nio.ch.Net.connect(Net.java:457)
        at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:670)
        at kafka.network.BlockingChannel.connect(BlockingChannel.scala:57)
        at kafka.producer.SyncProducer.connect(SyncProducer.scala:141)
        at kafka.producer.SyncProducer.getOrMakeConnection(SyncProducer.scala:156)
        at kafka.producer.SyncProducer.kafka$producer$SyncProducer
doSend(SyncProducer.scala:68)atkafka.producer.SyncProducer.send(SyncProducer.scala:112)atkafka.client.ClientUtils$.fetchTopicMetadata(ClientUtils.scala:53)atkafka.producer.BrokerPartitionInfo.updateInfo(BrokerPartitionInfo.scala:82)atkafka.producer.async.DefaultEventHandler
anonfun$handle$1.apply$mcV$sp(DefaultEventHandler.scala:67)
        at kafka.utils.Utils$.swallow(Utils.scala:167)
        at kafka.utils.Logging$class.swallowError(Logging.scala:106)
        at kafka.utils.Utils$.swallowError(Utils.scala:46)
        at kafka.producer.async.DefaultEventHandler.handle(DefaultEventHandler.scala:67)
        at kafka.producer.async.ProducerSendThread.tryToHandle(ProducerSendThread.scala:104)
        at kafka.producer.async.ProducerSendThread
anonfun$processEvents$3.apply(ProducerSendThread.scala:87)atkafka.producer.async.ProducerSendThread
anonfun$processEvents$3.apply(ProducerSendThread.scala:67)
        at scala.collection.immutable.Stream.foreach(Stream.scala:526)
        at kafka.producer.async.ProducerSendThread.processEvents(ProducerSendThread.scala:66)
        at kafka.producer.async.ProducerSendThread.run(ProducerSendThread.scala:44)
[2014-12-02 14:16:21,575] ERROR fetching topic metadata for topics [Set(topic1)] from broker [ArrayBuffer(id:0,host:localhost,port:9092)] failed (kafka.utils.Utils$)
kafka.common.KafkaException: fetching topic metadata for topics [Set(topic1)] from broker [ArrayBuffer(id:0,host:localhost,port:9092)] failed


原因:是在集群环境里执行了单机的命令

解决方法:

1)vi producer.properties

#metadata.broker.list=localhost:9092
metadata.broker.list=192.168.11.222:9092,192.168.11.221:9092,192.168.11.220:9092

2)./kafka-console-producer.sh --broker-list IP1:9092,IP2:9092,IP3:9092 --topic topic1

[2015-01-27 16:36:40,598] ERROR Producer connection to ubuntu06:9092 unsuccessful (kafka.producer.Sy

出现上面的错误是因为在本地的hosts里没有配置hostname 解决办法: sudo vi /etc/hosts #add 192.168.0.106 ubuntu06...

Kafka源码分析之Sender

Sender为处理发送produce请求至Kafka集群的后台线程。这个线程更新集群元数据,然后发送produce请求至适当的节点。...

kafka的producer报错异常

kafka的producer出现异常,现象如下 Exception in thread “Thread-0” kafka.common.FailedToSendMessageException: F...

Kafka学习笔记

1、在使用Java API访问之前先在安装有kafka的各个节点启动服务 bin/kafka-server-start.sh config/server.properties & 2、报如下错误 pr...

Kafka:Producer生产者发送逻辑 - 源码

1. 简述注:kafka版本为0.10.1.0 本文大致梳理Producer的发送过程,若有不对请指出。 我们在使用producer客户端,基本使用方法如下:KafkaProducer produ...
  • jiecxy
  • jiecxy
  • 2017年02月27日 19:50
  • 640

Kafka 新版Producer Java版代码阅读

Kafka Producer 代码阅读Kafka在0.8.2.1出了新版Producer,支持ack(仅Java版,因为通过JavaClient实现的)。因此对代码进行了简单阅读,并记录如下:接口如下...

kafka发送消息出现的问题KafKa error java.nio.channels.UnresolvedAddressException

出现以下的错 124  [main] INFO  kafka.utils.VerifiableProperties - Verifying properties 157  [main] I...

开发Kafka通用数据平台中间件

http://www.cnblogs.com/darkprince/p/5114425.html 目录: 一. Kafka概述 二. Kafka启动命令 三.我们为什么使用Kafka 四...

Kafka系列2-producer和consumer报错

1. 使用127.0.0.1启动生产和消费进程: 1)启动生产者进程: bin/kafka-console-producer.sh --broker-list 127.0.0.1:9092...
  • kuluzs
  • kuluzs
  • 2016年06月03日 11:39
  • 21123

Kafka 0.9+Zookeeper3.4.6集群搭建、配置,新Client API的使用要点,高可用性测试,以及各种坑

原文章地址:http://kelgon.iteye.com/blog/2287985 Kafka 0.9版本对java client的api做出了较大调整,本文主要总结了Kafka 0....
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:kafka入门1-集群生产消息 报:ERROR Producer connection to localhost:9092 unsuccessful
举报原因:
原因补充:

(最多只允许输入30个字)