Thanks to Jun Rao.Using a ZK shell to connect to ZK is no problem.Today, I use kafka-console-producer.sh to test, it also very slow at begin. It block for some minute before can send message.The log with kafka-console-producer.sh is blow: [2012-08-31 13:31:19,054] INFO Initiating client connection, connectString=192.168.32.79:9009 sessionTimeout=6000 watcher=org.I0Itec.zkclient.ZkClient@1fa12495 (org.apache.zookeeper.ZooKeeper)[2012-08-31 13:31:19,085] INFO Opening socket connection to server /192.168.32.79:9009 (org.apache.zookeeper.ClientCnxn)[2012-08-31 13:31:19,093] INFO Socket connection established to m32p79.bfdabc.com/192.168.32.79:9009, initiating session (org.apache.zookeeper.ClientCnxn)[2012-08-31 13:31:19,167] INFO Session establishment complete on server m32p79.bfdabc.com/192.168.32.79:9009, sessionid = 0x238834e29509373, negotiated timeout = 6000 (org.apache.zookeeper.ClientCnxn)[2012-08-31 13:31:19,170] INFO zookeeper state changed (SyncConnected) (org.I0Itec.zkclient.ZkClient)
[2012-08-31 13:35:21,346] INFO Creating async producer for broker id = 2 at 192.168.32.128:9092 (kafka.producer.ProducerPool)[2012-08-31 13:35:21,347] INFO Creating async producer for broker id = 1 at 192.168.32.222:9092 (kafka.producer.ProducerPool)[2012-08-31 13:35:21,348] INFO Creating async producer for broker id = 3 at 192.168.32.129:9092 (kafka.producer.ProducerPool)[2012-08-31 13:35:21,349] INFO Creating async producer for broker id = 0 at 192.168.32.221:9092 (kafka.producer.ProducerPool) From the log, we can see it block at "INFO zookeeper state changed". After about four minutes, it is ok.And the network is well. ----- Original Message ----- From: Jun Rao <[email protected]> To: [email protected], [email protected] Subject: Re: a problem with producer(it block for some minutes) Date: 2012-08-31 12:56 Could you try connecting ZK from a ZK shell and see if there is a connection issue? Thanks, Jun On Thu, Aug 30, 2012 at 4:19 AM, <[email protected]> wrote: > Hi,all > I meet a problem with producer. When the producer client is > initializing, it block for some minutes. I find it block at "producer = > new Producer<String, String>(config)". Is it the problem of zookeeper? I > think so. But I could not find what wrong with it. The cluster is an > zookeeper and four brokers. At the begin, the cluster work well. The > producer client and consumer client work well too. But now, the > initialization of producer client is very slow, it block at "producer = new > Producer<String, String>(config)" for some minutes. When the > connection has finished, it work well. The consumer client work well > now. It has not occured block when initializing. I use the kafka 0.7.1. I > want to know what is the reason. How can I resolve it? Thanks.
