#onenote# Zookeeper

Standalone Operation

 

To start ZooKeeper you need a configuration file. Here is a sample, create it in conf/zoo.cfg:

tickTime=2000
dataDir=/var/lib/zookeeper     //the location to store the in-memory database snapshots
clientPort=2181

 

 

Now that you created the configuration file, you can start ZooKeeper:

bin/zkServer.sh start

 

 

Running Replicated ZooKeeper

 

Clone N (N is odd number) copies of zookeeper full folders, Config  zoo.cfg like

tickTime=2000
dataDir=<DataDirN>  // different for different node

dataLogDir=<LogDirN>  // different for different node

clientPort=2181
initLimit=5
syncLimit=2
server.1=zoo1:2888:3888   //  the former(2888) port to connect to other peers, the later(3888) for  for leader election
server.2=zoo2:2888:3888
server.3=zoo3:2888:3888

 

e.g.

 

Then start each zookeeper with command

bin/zkServer.sh start

 

 

Stop Zookeeper

 

bin/zkServer.sh stop

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s