• No products in the cart.

Zookeeper Framework Installation

 

For the installation of zookeeper, hadoop must be installed. On this system, hduser is the hadoop user. Let us follow the following below steps to install zookeeper.

Step1: Download a Stable Release

Visit official website of zookeeper website. It will shown in the image given below:

Now click on the Download link as shown in the image given below:

You will be redirected to a page where you will see several mirror sites link to download the zookeeper. Visit any suggested mirror site and you will get the different releases as shown in the image given below:

You will get the directory link of different releases. Explore the stable link:

And save the file as the image given below:

Step 2: Extract and Move

Extract the tar file and move it into the installation directory.

First, open the terminal and login through hadoop user. (On this system, hadoop user is “hduser”).

    $ su - hduser
    Password: 

Go to the Download directory. Here, in the below command, put your root user name at the place of user. (On this system, root user is gopal.)

    $ cd /home/user/Downloads/

To see whether your file is downloaded or not, run ls command. You will get the downloaded zookeeper file in this directory.

    $ ls

You can take help from the image given below:

**Extract the File:**

    $ sudo tar -zxvf zookeeper-3.4.9.tar.gz 

Move the extracted file into the installation directory:

    $ sudo mv zookeeper-3.4.9 /usr/local/zookeeper
    $ sudo chown hduser:hadoop /usr/local/zookeeper/

Step 3: Create configuration file

Open the configuration file named conf/zoo.cfg

    $ cd /usr/local/zookeeper/conf/
    $ sudo cp zoo_sample.cfg zoo.cfg
    $ sudo nano zoo.cfg

Edit the file zoo.cfg. Your file should have the following field given below:

    # The number of milliseconds of each tick
    tickTime=2000
    # The number of ticks that the initial
    # synchronization phase can take
    initLimit=10
    # The number of ticks that can pass between
    # sending a request and getting an acknowledgement
    syncLimit=5
    # the directory where the snapshot is stored.
    # do not use /tmp for storage, /tmp here is just
    # example sakes.
    dataDir=/tmp/zookeeper
    # the port at which the clients will connect
    clientPort=2181
    # the maximum number of client connections.
    # increase this if you need to handle more clients
    #maxClientCnxns=60
    #
    # Be sure to read the maintenance section of the
    # administrator guide before turning on autopurge.
    #
    # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
    #
    # The number of snapshots to retain in dataDir
    #autopurge.snapRetainCount=3
    # Purge task interval in hours
    # Set to "0" to disable auto purge feature
    #autopurge.purgeInterval=1

Use Ctrl+X and Y to save.

Step 4: Start and Stop zookeeper

    $ cd /usr/local/zookeeper/bin

To start zookeeper run the command given below:

    $ sudo ./zkServer.sh start

You will get the output like this:

    ZooKeeper JMX enabled by default
    Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
    Starting zookeeper ... STARTED

To connect to Zookeeper server using Java, use following command:

    $ ./zkCli.sh -server 127.0.0.1:2181

If everything goes right, you will see a screen showing some logs as listed below in the image: