When attempting out ZooKeeper for the frist time, it’s simplest to run it in standalone mode with one ZooKeeper server. you'll do that on a development machine, as an example. ZooKeeper needs Java 7 to run, therefore make sure you have installed frist. You don’t want Cygwin to run ZooKeeper on Windows, since there Windows versions of the ZooKeeper scripts. (Windows is supported only as a development platform, not as a production platform.
Download a stable release of ZooKeeper from the Apache ZooKeeper releases page atApache ZooKeeper - Releases
and unpack the tarball in a suitable location:
$ cd /usr/local
$ tar zxf zookeeper-x.x.x.tar.gz
$ mv zookeeper-x.x.x zookeeper
$ chown -R hduser:hduser zookeeperSetting .bashrc
Now Setup a entry in our .bashrc file for zookeeper,
export PATH=$PATH:[your old entries]:$ZK_HOME/bin.
For configuring the zookeeper goto $ZK_HOME/conf,ls
Setting up a ZooKeeper server in standalone mode is easy. The server is contained during a single JAR file, thus installation consists of making a configuration.
Once you've got downloaded a stable ZooKeeper release take it and cd to root.
To start ZooKeeper you would like a configuration file. Here could be a sample, make it in conf/zoo.cfg:
You dont wish to edit it however you'll want to edit the dataDir to one thing like dataDir=/app/zookeeper. this could be enough for running our zookeeper at port 2181 (default).
Before running the ZooKeeper service, we want to setup up a configuration file. The con- figuration file is conventionally called zoo.cfg and placed within the conf directory (al- although you'll be able to place it in /etc/zookeeper, or within the directory defined by the ZOOCFGDIR atmosphere variable, if set). Here’s associate example:
This is a super Java properties file, and also the three properties difine during this example are the minimum needed for running ZooKeeper in standalone mode. Briefly, tickTime is that the basic measure time in ZooKeeper (specified in milliseconds), data dir is that the local filesystem location wherever ZooKeeper stores persistent data, and client port is the port the ZooKeeper listens on for client connections (2181 could be a common choice). you must modification dataDir to associate applicable setting for your system.TickTime
The basic unit of time in milliseconds used by ZooKeeper. that's used to do heartbeats and therefore the minimum session timeout are doubly the tickTime.DataDir
The location to saveed the in-memory database snapshots and, unless given otherwise, the transaction log of updates to the database.ClientPort
The port to pay attention for client connections
Now that you make the configuration file, you will start ZooKeeper.With a an appropriate configuration defined, we will be now prepared to start a local ZooKeeper server:bin/Page on ZkServer start
ZooKeeper logs messages working with log4j -- a lot of detail available in the logging section of the Programmer's Guide. You will see log messages returning to the console (default) and/or a log file looking on the log4j configuration.
To check whether or not ZooKeeper is running, send the ruok command (“Are you OK?”) to
the client port using nc (telnet works, too):
$echo ruok | nc localhost 2181
After complete Installation you can follow given command and check your zookeeperPage on ZkServer supports the following commands:
After following this block.you have installed zookeeper successfully.Now you can use also with hadoop.
Visit-- Installing and Running Apache ZooKeeper