Académique Documents
Professionnel Documents
Culture Documents
Use Cases :
Zookeeper now these getting popularity for distributed application like
hadoop, Flume ,HBase etc.
For any distributed application , ZooKeeper is a centralized service for maintaining configuration
information, naming, providing distributed synchronization, and providing group services.
Each time they are implemented there is a lot of work that goes into fixing the bugs and race conditions that
are inevitable. Because of the difficulty of implementing these kinds of services, applications initially
usually skimp on them ,which make them brittle in the presence of change and difficult to manage.
Once ,Zookeeper been deployed , it can be shared accross number of distributed Apllication for
maintaining configuration information, naming, providing distributed synchronization, and providing group
services.
If large data storage is needed, the usually pattern of dealing with such data is to store it on a bulk storage
system, such as NFS or HDFS, and store pointers to the storage locations in ZooKeeper.
Zookeeper ensemble:
Like the distributed processes it coordinates, ZooKeeper itself is intended to be replicated over a sets of
hosts called an Zookeeper ensemble.
In zookeeper ensemble , all zookeeper server must all know about each other zookeeper server . They
maintain an in-memory image of state, along with a transaction logs and snapshots in a persistent store.
Clients connect to a single ZooKeeper server. The client maintains a TCP connection through which it
sends requests, gets responses, gets watch events, and sends heart beats. If the TCP connection to the server
breaks, the client will connect to a different server.
ZooKeeper stamps each update with a number that reflects the order of all ZooKeeper transactions.
Subsequent operations can use the order to implement higher-level abstractions, such as synchronization
primitives, deadlocks etc.
these as.
initLimit=10
syncLimit=5
clientPort=2184
server.1=
server.2=
server.3= localhost:2890:3890
server.2 : /usr/local/zookeeper2/conf/zoo.cfg
tickTime=2000
dataDir=/var/zookeeper2
localhost:2888:3888
localhost:2889:3889
initLimit=10
syncLimit=5
clientPort=2185
server.1=
server.2=
server.3= localhost:2890:3890
server.3 : /usr/local/zookeeper3/conf/zoo.cfg
tickTime=2000
dataDir=/var/zookeeper3
localhost:2888:3888
localhost:2889:3889
initLimit=10
syncLimit=5
clientPort=2186
server.1=
server.2=
server.3= localhost:2890:3890
/var/zookeeper2/myid
contains
3
cd
/usr/local/zookeeper1/ $
bin/zkServer.sh
start
bin/zkServer.sh
start
bin/zkServer.sh
start
At Terminal 2:
$
cd
/usr/local/zookeeper2/ $
At Terminal 3:
$
cd
/usr/local/zookeeper3/ $
Once ZooKeeper is running, you have several options for connection to it:
Java: Use
$ cd <path_to_zookeeper_root>
<hostname>:<clientPort>
$ bin/zkCli.sh -server
As here :
$ cd /usr/local/zookeeper1
localhost:2184
$ bin/zkCli.sh -server
LD
_LIBRARY_PATH=.
Step :3
Define server-id
Create a file named myid at dataDir directory as specified in configuration.and put id of that server.
For this cluster , create file myid at three place as shown :
At
At
At
192.168.145.110
192.168.145.111
192.168.145.112
/var/zookeeper
/var/zookeeper
/var/zookeeper
contains
contains
contains
1
2
3
you created the configuration file, you can start Zookeepers with terminal .
At each machine :
$
cd
/usr/local/zookeeper-3.3.1/
bin/zkServer.sh
start
Hopefully this article is helping you out. and tried to make it simple and
http://archive.cloudera.com/cdh/3/zookeeper/zookeeperStarted.html
http://hadoop.apache.org/zookeeper/docs/current/javaExample.html
http://hadoop.apache.org/zookeeper/docs/current/zookeeperOver.html