# zookeeper api

Before installing ZooKeeper, make sure your system is running on any of the following operating systems −

• Any of Linux OS − Supports development and deployment. It is preferred for demo applications.

• Windows OS − Supports only development.

• Mac OS − Supports only development.

ZooKeeper server is created in Java and it runs on JVM. You need to use JDK 6 or greater.

Now, follow the steps given below to install ZooKeeper framework on your machine.

## Step 1: Verifying Java Installation

We believe you already have a Java environment installed on your system. Just verify it using the following command.

$tar -zxf jdk-8u60-linux-x64.gz  ### Step 1.3: Move to opt directory To make Java available to all users, move the extracted java content to “/usr/local/java” folder. $ su
$mkdir /opt/jdk$ mv jdk-1.8.0_60 /opt/jdk/


### Step 1.4: Set path

To set path and JAVA_HOME variables, add the following commands to ~/.bashrc file.

export JAVA_HOME = /usr/jdk/jdk-1.8.0_60
export PATH=$PATH:$JAVA_HOME/bin


Now, apply all the changes into the current running system.

$source ~/.bashrc  ### Step 1.5: Java alternatives Use the following command to change Java alternatives. update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_60/bin/java 100  ### Step 1.6 Verify the Java installation using the verification command (java -version) explained in Step 1. ## Step 2: ZooKeeper Framework Installation ### Step 2.1: Download ZooKeeper To install ZooKeeper framework on your machine, visit the following link and download the latest version of ZooKeeper. http://zookeeper.apache.org/releases.html As of now, the latest version of ZooKeeper is 3.4.6 (ZooKeeper-3.4.6.tar.gz). ### Step 2.2: Extract the tar file Extract the tar file using the following commands − $ cd opt/
$tar -zxf zookeeper-3.4.6.tar.gz$ cd zookeeper-3.4.6
$mkdir data  ### Step 2.3: Create configuration file Open the configuration file named conf/zoo.cfg using the command vi conf/zoo.cfg and all the following parameters to set as starting point. $ vi conf/zoo.cfg

tickTime = 2000
clientPort = 2181
initLimit = 5
syncLimit = 2


Once the configuration file has been saved successfully, return to the terminal again. You can now start the zookeeper server.

### Step 2.4: Start ZooKeeper server

Execute the following command −

$bin/zkServer.sh start  After executing this command, you will get a response as follows − $ JMX enabled by default
$Using config: /Users/../zookeeper-3.4.6/bin/../conf/zoo.cfg$ Starting zookeeper ... STARTED


### Step 2.5: Start CLI

Type the following command −