Ravi Sinha
Ravi Sinha

Reputation: 39

ZooKeeper not getting started

I am facing issue while starting zookeeper. zoo.cfg file is

# The number of milliseconds of each tick
tickTime=2000
dataDir=/Users/admin/Documents/delete/zookeeper/zookeeper-3.4.6/zookeeperdata/1
clientPort=2181
initLimit=5
syncLimit=2
server.1=localhost:2888:3888
server.2=localhost:2889:3889
server.3=localhost:2890:3890

I don't see any error while starting zookeeper :

nohup ./bin/zkServer.sh start zoo.cfg
JMX enabled by default
Using config: /Users/admin/Documents/delete/zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

could see a new process Id also :

cat /Users/admin/Documents/delete/zookeeper/zookeeper-3.4.6/zookeeperdata/1/zookeeper_server.pid 
14120

But while checking the status of the process, getting below error:

bin/zkServer.sh status
JMX enabled by default
Using config: /Users/admin/Documents/delete/zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
Error contacting service. It is probably not running

Could you please help.

Upvotes: 1

Views: 3901

Answers (1)

Petter
Petter

Reputation: 1337

server.1=localhost:2888:3888
server.2=localhost:2889:3889
server.3=localhost:2890:3890

This means that you're setting up a ZooKeeper ensemble, and one of the rules for a zk-ensamble is that the servers needs to form a majority before they are allowed to answer requests. This means that a zk-server is not running until it has formed a majority.

To get an informative answer from status you need to have at least 2 out of 3 servers running for a 3 server ensemble. Either remove these lines from your config or start another server. (And make sure the servers have different 'dataDir' and 'myid'.)

(Something a lot of people misunderstand is that the majority that is necessary is not a majority among the started servers but a majority among the servers in the configuration.)

Upvotes: 0

Related Questions