Anil Gupta
Anil Gupta

Reputation: 1126

Set zookeeper.connect property in Kafka Producer

I am using Kafka0.8.1. I need to set zookeeper.connect property while instantiating Producer. I am setting the property like this:

Properties props = new Properties(); 
props.put("zookeeper.connect","zookeeper2:2181,zookeeper3:2181,zookeeper1:2181/kafka");

But, kafka keeps on complaining this:

[main] utils.Logging$class(83): Property zookeeper.connect is not valid

I have looked here: https://kafka.apache.org/08/configuration.html Still, i dont understand what's wrong in "zookeeper.connect" value. I would appreciate if anyone can point out the mistake.

Upvotes: 1

Views: 18247

Answers (3)

felixlechat
felixlechat

Reputation: 1

Acording to documentation, you need a semicolon-separated list of hostname. You are using a coma separated list

Upvotes: 0

lidox
lidox

Reputation: 1971

I just added following line:

properties.setProperty("zookeeper.connect", "localhost:2181");

Upvotes: 0

jbarrueta
jbarrueta

Reputation: 5185

According to the configuration page zookeeper.connect is a property for the Broker and/or the Consumer, not a Producer property, instead you will need to set metadata.broker.list, this is section 3.3 Producer Configs.

Hope it helps!

Upvotes: 4

Related Questions