Kafka single-node deployment cannot access problem resolution

Source: Internet
Author: User

Scenario: A virtual machine is installed in the notebook and a Kafka service is deployed on the local virtual machine:

Write a test program, run the test program on the notebook, access the Kafka on the virtual machine, and report the following exception:

2015-01-15 09:33:26 [Kafka.producer.async.defaulteventhandler]-[info] back off for the MS before retrying send. Remaining retries = 1

2015-01-15 09:33:26 [Kafka.client.clientutils$]-[info] fetching metadata from broker Id:0,host:192.168.108.136,port : 9092 with Correlation ID 9 for 1 topic (s) Set (client-all-log-test)

2015-01-15 09:33:26 [Kafka.producer.syncproducer]-[info] Connected to 192.168.108.136:9092 for producing

2015-01-15 09:33:26 [Kafka.producer.syncproducer]-[info] disconnecting from 192.168.108.136:9092

2015-01-15 09:33:47 [Kafka.producer.syncproducer]-[error] producer connection to ubuntu-machine:9092 unsuccessful

java.net.ConnectException : Connection timed Out:connect

At Sun.nio.ch.Net.connect0 ( Native Method)

At Sun.nio.ch.Net.connect (Unknown Source)

At Sun.nio.ch.Net.connect (Unknown Source)

At Sun.nio.ch.SocketChannelImpl.connect (Unknown Source)

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)

At kafka.producer.syncproducer$ $anonfun $send$1$ $anonfun $apply$mcv$sp$1.apply$mcv$sp (syncproducer.scala:102)

At kafka.producer.syncproducer$ $anonfun $send$1$ $anonfun $apply$mcv$sp$1.apply (syncproducer.scala:102)

At kafka.producer.syncproducer$ $anonfun $send$1$ $anonfun $apply$mcv$sp$1.apply (syncproducer.scala:102)

At Kafka.metrics.KafkaTimer.time (kafkatimer.scala:33)

At kafka.producer.syncproducer$ $anonfun $send$1.apply$mcv$sp (syncproducer.scala:101)

At kafka.producer.syncproducer$ $anonfun $send$1.apply (syncproducer.scala:101)

At kafka.producer.syncproducer$ $anonfun $send$1.apply (syncproducer.scala:101)

At Kafka.metrics.KafkaTimer.time (kafkatimer.scala:33)

At Kafka.producer.SyncProducer.send (syncproducer.scala:100)

At kafka.producer.async.defaulteventhandler.kafka$producer$async$defaulteventhandler$ $send ( defaulteventhandler.scala:255)

At kafka.producer.async.defaulteventhandler$ $anonfun $dispatchserializeddata$2.apply (Defaulteventhandler.scala : 106)

At kafka.producer.async.defaulteventhandler$ $anonfun $dispatchserializeddata$2.apply (Defaulteventhandler.scala : 100)

At scala.collection.mutable.hashmap$ $anonfun $foreach$1.apply (hashmap.scala:95)

At scala.collection.mutable.hashmap$ $anonfun $foreach$1.apply (hashmap.scala:95)

At Scala.collection.iterator$class.foreach (iterator.scala:772)

At scala.collection.mutable.hashtable$ $anon $1.foreach (hashtable.scala:157)

At Scala.collection.mutable.hashtable$class.foreachentry (hashtable.scala:190)

At Scala.collection.mutable.HashMap.foreachEntry (hashmap.scala:45)

At Scala.collection.mutable.HashMap.foreach (hashmap.scala:95)

At Kafka.producer.async.DefaultEventHandler.dispatchSerializedData (defaulteventhandler.scala:100)

At Kafka.producer.async.DefaultEventHandler.handle (defaulteventhandler.scala:72)

At Kafka.producer.Producer.send (producer.scala:76)

At Kafka.javaapi.producer.Producer.send (producer.scala:33)

At Me.learn.kafka.demo.TestProducer.main ( testproducer.java:38)

Exception in thread "main" kafka.common.FailedToSendMessageException : Failed-to-send messages after 3 tries.

At Kafka.producer.async.DefaultEventHandler.handle (defaulteventhandler.scala:90)

At Kafka.producer.Producer.send (producer.scala:76)

At Kafka.javaapi.producer.Producer.send (producer.scala:33)

At Me.learn.kafka.demo.TestProducer.main ( testproducer.java:38)

The reason should be network problems, but check the firewall settings, there is no limit, the program deployed by the virtual machine is located on the server, you can run it, the description or network restrictions.

You need to change the following two properties in Server.properties under the Config folder

zookeeper.connect=localhost:2181 #改成zookeeper. connect=10.0.30.221:2181  #去掉host. Name Comment #host.name= localhost converted to host.name=10.0.30.221

Kafka single-node deployment cannot access problem resolution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.