Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Kafka, mail # user - Bad user experience when out of box


Copy link to this message
-
Re: Bad user experience when out of box
Joe Stein 2012-02-07, 10:36
SuoNayi,

In line 32 of examples/src/main/java/kafka/examples/Producer.java

props.put("zk.connect", "localhost:2181");

change that to zk host and port in real world you can be passing that
structure in like ProducerShell does from properties file
/*
Joe Stein
http://www.linkedin.com/in/charmalloc
Twitter: @allthingshadoop <http://www.twitter.com/allthingshadoop>
*/

On Mon, Feb 6, 2012 at 9:26 PM, SuoNayi <[EMAIL PROTECTED]> wrote:

> Hi all,
>   I'm new to kafka.I set up zooker server and kafka server on my test
> server by following the quickstart.
>   I also success running the example list in the quickstart,such as step 3
> and step 4.
>   Now I set up a project on my pc to run examples of directory named
> kafka-0.7.0-incubating-src\examples.
>   Of course, I changed addresses  and ports of zk server and kafka that
> both pointed at my test server.
>   When start the main function of class KafkaConsumerProducerDemo,it
> throws the following exception:
> Exception in thread "main"
> org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to
> zookeeper server within timeout: 6000
> at org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:876)
> at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:98)
> at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:84)
> at
> kafka.producer.ZKBrokerPartitionInfo.<init>(ZKBrokerPartitionInfo.scala:63)
> at kafka.producer.Producer.<init>(Producer.scala:53)
> at kafka.javaapi.producer.Producer.<init>(Producer.scala:33)
> at kafka.javaapi.producer.Producer.<init>(Producer.scala:40)
> at kafka.examples.Producer.<init>(Producer.java:35)
> at
> kafka.examples.KafkaConsumerProducerDemo.main(KafkaConsumerProducerDemo.java:23)
>   I have to specify the timeout value for zk,like this,
> zk.connectiontimeout.ms=10000 and the client could connect to zk server
> successfully.
>   But another new exception is thrown again:
> Exception in thread "Thread-0" java.nio.channels.ClosedChannelException
> at sun.nio.ch.SocketChannelImpl.ensureWriteOpen(Unknown Source)
> at sun.nio.ch.SocketChannelImpl.write(Unknown Source)
> at
> kafka.network.BoundedByteBufferSend.writeTo(BoundedByteBufferSend.scala:48)
> at kafka.network.Send$class.writeCompletely(Transmission.scala:76)
> at
> kafka.network.BoundedByteBufferSend.writeCompletely(BoundedByteBufferSend.scala:25)
> at kafka.producer.SyncProducer.liftedTree1$1(SyncProducer.scala:88)
> at kafka.producer.SyncProducer.send(SyncProducer.scala:87)
> at kafka.producer.SyncProducer.send(SyncProducer.scala:117)
> at
> kafka.producer.ProducerPool$$anonfun$send$1.apply$mcVI$sp(ProducerPool.scala:116)
> at
> kafka.producer.ProducerPool$$anonfun$send$1.apply(ProducerPool.scala:102)
> at
> kafka.producer.ProducerPool$$anonfun$send$1.apply(ProducerPool.scala:102)
> 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:102)
> at kafka.producer.Producer.zkSend(Producer.scala:143)
> at kafka.producer.Producer.send(Producer.scala:105)
> at kafka.javaapi.producer.Producer.send(Producer.scala:104)
> at kafka.examples.Producer.run(Producer.java:45)
>  Hope someone could help me, thanks very much!
>
>
> SuoNayi
>
>
>
>