Morriskim
Morriskim

Reputation: 91

kafka Missing required configuration "zookeeper.connect" which has no default value

I setup kafka cluster in vm.

but i have a problem.

My kafka version is kafka 2.11-0.0.0

 $ bin/kafka-server-start.sh config/zookeeper.properties 
[2017-01-31 09:15:55,216] FATAL  (kafka.Kafka$)
org.apache.kafka.common.config.ConfigException: Missing required configuration "zookeeper.connect" which has no default value.
    at org.apache.kafka.common.config.ConfigDef.parse(ConfigDef.java:148)
    at org.apache.kafka.common.config.AbstractConfig.<init>(AbstractConfig.java:49)
    at org.apache.kafka.common.config.AbstractConfig.<init>(AbstractConfig.java:56)
    at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:702)
    at kafka.server.KafkaConfig$.fromProps(KafkaConfig.scala:691)
    at kafka.server.KafkaServerStartable$.fromProps(KafkaServerStartable.scala:28)
    at kafka.Kafka$.main(Kafka.scala:58)
    at kafka.Kafka.main(Kafka.scala)

please help me .

my zookeeper.properties (down)


zookeeper.properties

dataDir=/home/kafka01/zookeeper-data
# the port at which the clients will connect
clientPort=2181
# disable the per-ip limit on the number of connections since this is a non-production config
maxClientCnxns=0
initLimit=5
syncLimit=2
server.1=kafka01:2888:3888
server.2=kafka02:2888:3888
server.3=kafka03:2888:3888

server.properties

zookeeper.connect=kafka01:2181,kafka02:2181,kafka03:2181

what is the problem??

Upvotes: 9

Views: 22231

Answers (6)

arob_tihom
arob_tihom

Reputation: 1

You need to start the zookeeper with:

zookeeper-server-start.sh ~/kafka/config/zookeeper.properties

Then you need to start the kafka-server using:

kafka-server-start.sh ~/kafka/config/server.properties

Now your kafka will run smoothly

Upvotes: 0

Sumit Malpure
Sumit Malpure

Reputation: 91

You are trying to start kafka server with zookeeper config properties file and that's why you are getting the above error.

Use the commands below instead:

Zookeeper:

.\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties

Kafka:

.\bin\windows\kafka-server-start.bat .\config\server.properties

Upvotes: 9

P N Jain
P N Jain

Reputation: 422

This is the error because there is an issue with your command.

To start zookeeper run -

zookeeper-server-start.sh config/zookeeper.properties

To start server run -

kafka-server-start.sh config/zookeeper.properties

Upvotes: 1

vsk.rahul
vsk.rahul

Reputation: 503

There are two ways you can start Kafka server:

  1. Start the zookeeper server separately(on your local or another machine)
  2. Start the zookeeper server which is embedded with Kafka server (kafka_2.12/libs/zookeeper-3.4.13.jar)

In first case: I am assuming you have started the zookeeper server already and that is running on localhost:2181

So now you are good to start kafka server using following command

bin\windows\kafka-server-start.bat ..\..\config\server.properties

In server.properties file you have to tell Kafka server where is/are the zookeeper(s) running. Using property:

## zookeeper.connect=localhost:2181 [default]
zookeeper.connect=zk1:2181, zk2:2181, localhost:2181

In second case

Start the zookeeper first (embedded with the Kafka server)

bin\windows\zookeeper-server-start.bat ..\..\config\zookeeper.properties

Then, start the Kafka server:

bin\windows\kafka-server-start.bat ..\..\config\server.properties

Upvotes: 5

Chang Shu
Chang Shu

Reputation: 77

You stared the wrong script. It should be:
bin/zookeeper-server-start.sh config/zookeeper.properties

Upvotes: 6

jose.goncabel
jose.goncabel

Reputation: 440

You are trying to start a kafka server but you are passing the wrong config file.

Usually you want to start a kafka server using the following command:

./kafka-server-start.sh ../config/server.properties

And is in this file where you specify the address of the zookeeper:

zookeeper.connect=kafka01:2181,kafka02:2181,kafka03:2181

The quickstart guide in the kafka official documentation is quite good, I recommend you to have a look at it. You can find it here.

Upvotes: 14

Related Questions