How to Install ZooKeeper on Linux Mint Latest

In this tutorial, we will guide you through the installation process of ZooKeeper on Linux Mint. ZooKeeper is a centralized service used to maintain configuration information, naming, synchronization, and group services.

Prerequisites

  • A Linux Mint Latest machine
  • Java Development Kit 1.8 or higher installed on the machine

Step 1: Download the Latest Version of ZooKeeper

The first step in this tutorial is to download the latest version of ZooKeeper from the official Apache ZooKeeper website [http://zookeeper.apache.org/releases.html].

You can download the latest stable release of ZooKeeper by running the following command:

$ wget https://downloads.apache.org/zookeeper/stable/zookeeper-3.6.3.tar.gz

Step 2: Extract the ZooKeeper Tarball

In this step, we will extract the downloaded ZooKeeper tarball. Use the following command to extract the tarball.

$ tar -xvf zookeeper-3.6.3.tar.gz

This will extract the ZooKeeper files into a directory named zookeeper-3.6.3.

Step 3: Configure the ZooKeeper Server

We need to create a zookeeper configuration file by copying the zoo_sample.cfg file provided in the ZooKeeper directory. Run the following command to copy the configuration file:

$ cd zookeeper-3.6.3/
$ cp conf/zoo_sample.cfg conf/zoo.cfg

Next, open the zoo.cfg configuration file using your preferred editor:

$ nano conf/zoo.cfg

And configure ZooKeeper with the following properties:

tickTime=2000
dataDir=/var/lib/zookeeper
clientPort=2181

Save and close the zoo.cfg file.

Step 4: Create Data Directory

In this step, we will create the data directory for ZooKeeper. Use the following command to create a directory:

$ sudo mkdir -p /var/lib/zookeeper

Next, change the ownership of the directory to the zookeeper user:

$ sudo chown -R zookeeper:zookeeper /var/lib/zookeeper

Step 5: Set Environment Variables

In this step, we will set environment variables for ZooKeeper server.

$ sudo nano /etc/profile.d/zookeeper.sh

And add the following details to the file:

export ZOOKEEPER_HOME=/opt/zookeeper-3.6.3
export PATH=$ZOOKEEPER_HOME/bin:$PATH

Save and exit the file.

Step 6: Start the ZooKeeper Server

We have now completed the setup of ZooKeeper. To start the server, use the following command:

$ zkServer.sh start

If everything is correctly set up, you should see a message similar to this:

ZooKeeper JMX enabled by default
Using config: /opt/zookeeper-3.6.3/bin/../conf/zoo.cfg
Starting zookeeper … STARTED

Step 7: Verify the Installation

To verify that the installation was successful, use the following command:

$ zkCli.sh -server 127.0.0.1:2181

This command will establish a client connection to the ZooKeeper server. If the connection is successful, you should see the following message:

Welcome to ZooKeeper!
...
[zk: 127.0.0.1:2181(CONNECTED) 0]

Conclusion

In this tutorial, we have demonstrated the steps required to install ZooKeeper on Linux Mint. You can now use ZooKeeper to maintain configuration information, naming, synchronization, and group services.