original article:http://zookeeper.praveendeshmane.co.in/zookeeper/ zookeeper-3-4-6-single-server-setup-on-ubuntu-14-04.jsp
---------------------------------------------------------
Apache ZooKeeper is a software project of the Apache software Foundation. It is essentially a distributed hierarchical Key-value store, which are used to provide a distributed configuration service , synchronization service, and naming registry for large distributed systems. ZooKeeper was a sub-project of Hadoop but are now a top-level project in its own right.
ZooKeeper ' s architecture supports high availability through redundant services. The clients can thus ask another ZooKeeper leader if the first fails to answer. ZooKeeper nodes store their data in a hierarchical name space, much like a file system or a tree data structure. Clients can read from and write to the nodes and in this is a shared configuration service. Updates are totally ordered.
Pre Requirements
1) A machine with Ubuntu 14.04 LTS operating system
2) Apache Hadoop 2.6.4 Pre installed (how-to-install Hadoop on Ubuntu 14.04)
3) Apache ZooKeeper 3.4.6 Software (Download here)
ZooKeeper 3.4.6 single Server setup on Ubuntu
Installation Steps
Step 1- Update. Open a terminal (CTRL + ALT + T) and type the following sudo command. It is advisable-to-run this before installing all package, and necessary-to-run it to install the latest updates, even if You are not added or removed any software Sources.
$ sudo apt-get update
Step 2- installing Java 7.
$ sudo apt-get install OPENJDK-7-JDK
Step 3- Edit $HOME/.BASHRC file by adding the Java path.
$ sudo gedit $HOME/.BASHRC
$HOME/.bashrc file. Add the following lines
Export JAVA_HOME=/USR/LIB/JVM/JAVA-7-OPENJDK-AMD64
Step 4- Reload your changed $HOME/.BASHRC settings
$ source $HOME/.BASHRC
Step 5- Creating Zookeeper directory.
$ sudo mkdir/usr/local/zookeeper
Step 6- Change the ownership and permissionsof the Directory/usr/local/zookeeper. Here ' HDUser ' are an Ubuntu username.
$ sudo chown-r hduser/usr/local/zookeeper
$ sudo chmod-r 755/usr/local/zookeeper
Step 7- creating/zookeeper/data directory.
$ sudo mkdir/usr/local/zookeeper/data
Step 8- Change the ownership and permissionsof the Directory/usr/local/zookeeper/data. Here ' HDUser ' are an Ubuntu username.
$ sudo chown-r hduser/usr/local/zookeeper/data
$ sudo chmod-r 755/usr/local/zookeeper/data
Step 9- creating/zookeeper/log directory.
$ sudo mkdir/usr/local/zookeeper/log
Step Ten- Change the ownership and permissionsof the Directory/usr/local/zookeeper/log. Here ' HDUser ' are an Ubuntu username.
$ sudo chown-r hduser/usr/local/zookeeper/log
$ sudo chmod-r 755/usr/local/zookeeper/log
Step One- Change the directory To/home/hduser/desktop , in my case the downloaded zookeeper-3.4.6.tar.gz file is In/home/hduser/desktop folder. For you it might is in /downloads folder check it.
$ cd/home/hduser/desktop/
Step- Untar the zookeeper-3.4.6.tar.gz file.
$ tar xzf zookeeper-3.4.6.tar.gz
Step- Move the contents of zookeeper-3.4.6 folder To/usr/local/zookeeper
$ mv zookeeper-3.4.6/*/usr/local/zookeeper
Step- Change the directory to/usr/local/zookeeper/conf
$ cd/usr/local/zookeeper/conf
Step- Edit zoo.cfg file. If This file doesn ' t exists it would create one for your and it ll open for your to edit.
$ gedit Zoo.cfg
Step- Add following lines to zoo.cfg file. Save and close.
ticktime=2000datadir=/usr/local/zookeeper/datadatalogdir=/usr/local/zookeeper/logclientport=2181initlimit= 5synclimit=2
Step- Change the directory To/usr/local/zookeeper/bin
$ cd/usr/local/zookeeper/bin
Step- Start Zookeeper Server
$./zkserver.sh Start
Step- Start Client
$./zkcli.sh-server 127.0.0.1:2181
Step- Stop Zookeeper Server
$./zkserver.sh Stop
Share this blog post and follow me for latest updates on
Installation of Apache Zookeeper