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.
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
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
.
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.
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
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.
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
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]
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.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!