Hi,
This is a very basic question, hopefully I'm not wasting too much of anyone's
time.
I have kafka and zookeeper running on one machine. I've written a very simple
producer client (in Java) that works fine when run from the same machine on
which kafka and zookeeper are running. However, if I run the simple client I
wrote on a different machine, I'm not able to send any messages. The relevant
log section is at the end of this mail.
Do I need to run something else on the machine where I'm trying to run the
client? The attempt to connect to 127.0.0.1:9092 seems suspect to me. I've
specified zk.connect as "192.168.137.128:2181".
Thanks for your time.
[2011-08-04 14:40:25,354] INFO Initiating client connection,
connectString=192.168.137.128:2181 sessionTimeout=6000
watcher=org.I0Itec.zkclient.ZkClient@cdfc9c (org.apache.zookeeper.ZooKeeper)
[2011-08-04 14:40:25,379] INFO Opening socket connection to server
/192.168.137.128:2181 (org.apache.zookeeper.ClientCnxn)
[2011-08-04 14:40:29,882] INFO Socket connection established to
192.168.137.128/192.168.137.128:2181, initiating session
(org.apache.zookeeper.ClientCnxn)
[2011-08-04 14:40:29,912] INFO Session establishment complete on server
192.168.137.128/192.168.137.128:2181, sessionid = 0x13195dd1d200007, negotiated
timeout = 6000 (org.apache.zookeeper.ClientCnxn)
[2011-08-04 14:40:29,914] INFO zookeeper state changed (SyncConnected)
(org.I0Itec.zkclient.ZkClient)
[2011-08-04 14:40:30,031] INFO Creating sync producer for broker id = 0 at
127.0.1.1:9092 (kafka.producer.ProducerPool)
[2011-08-04 14:40:31,088] ERROR Connection attempt failed, next attempt in 1 ms
(kafka.producer.SyncProducer)
java.net.ConnectException: Connection refused: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
at kafka.producer.SyncProducer.connect(SyncProducer.scala:171)
at
kafka.producer.SyncProducer.getOrMakeConnection(SyncProducer.scala:193)
at kafka.producer.SyncProducer.send(SyncProducer.scala:84)
at kafka.producer.SyncProducer.send(SyncProducer.scala:116)
at
kafka.producer.ProducerPool$$anonfun$send$1.apply$mcVI$sp(ProducerPool.scala:123)
at
kafka.producer.ProducerPool$$anonfun$send$1.apply(ProducerPool.scala:110)
at
kafka.producer.ProducerPool$$anonfun$send$1.apply(ProducerPool.scala:110)
at
scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:57)
at
scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:43)
at kafka.producer.ProducerPool.send(ProducerPool.scala:110)
at kafka.producer.Producer.send(Producer.scala:132)
at kafka.javaapi.producer.Producer.send(Producer.scala:101)
at Producer.perform(Producer.java:28)
at harness.Harness.run(Harness.java:37)
at java.lang.Thread.run(Unknown Source)
[2011-08-04 14:40:31,091] INFO Disconnecting from 127.0.1.1:9092
(kafka.producer.SyncProducer)
[2011-08-04 14:40:31,094] INFO Closing all sync producers
(kafka.producer.ProducerPool)