ZooKeeper is an open-source software project that provides distributed coordination services for large-scale distributed applications. It is a distributed system that allows applications to coordinate with each other across multiple servers.
MXLinux is a popular Linux distribution that is based on Debian. In this tutorial, we will be showing you how to install ZooKeeper on MXLinux Latest.
Before we begin, make sure that you have the following:
Before installing any new software, it is recommended to update the system to the latest version. Open the terminal and run the following command:
sudo apt update && sudo apt upgrade -y
ZooKeeper requires Java to be installed on the system. You can install Java by running the following command:
sudo apt install default-jdk -y
Verify the installation by running the following command:
java -version
The output should show the version of Java that you have installed.
Next, download the latest version of ZooKeeper from the official website. You can use the following command to download ZooKeeper 3.7.0:
wget https://downloads.apache.org/zookeeper/zookeeper-3.7.0/apache-zookeeper-3.7.0-bin.tar.gz
Once the download is complete, extract the downloaded file to the /opt directory:
sudo tar -xzvf apache-zookeeper-3.7.0-bin.tar.gz -C /opt/
Next, we need to configure ZooKeeper. ZooKeeper uses a configuration file located in the conf directory. We will create a copy of the distribution configuration file as follows:
cd /opt/apache-zookeeper-3.7.0-bin/conf/
sudo cp zoo_sample.cfg zoo.cfg
You can now edit the zoo.cfg file to suit your needs. Here, we will use the default settings. Open the file in the nano editor by running the following command:
sudo nano zoo.cfg
Next, add the following line to the file:
dataDir=/var/lib/zookeeper
This specifies the directory where ZooKeeper will store its data. Save the file and exit the editor by pressing Ctrl + X, followed by Y and Enter.
We can now start ZooKeeper by running the following command:
sudo /opt/apache-zookeeper-3.7.0-bin/bin/zkServer.sh start
You should see the following output:
ZooKeeper JMX enabled by default
Using config: /opt/apache-zookeeper-3.7.0-bin/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
To verify that ZooKeeper is running, we will connect to the ZooKeeper command-line interface by running the following command:
/opt/apache-zookeeper-3.7.0-bin/bin/zkCli.sh
You should see the following output:
Connecting to localhost:2181
2021-12-07 13:28:27,361 [myid:] - INFO [Thread-0:ZooKeeperClient@405] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@4e4cbc8d
Welcome to ZooKeeper!
JLine support is disabled
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
[zk: localhost:2181(CONNECTED) 0]
This means that ZooKeeper is running and we have successfully connected to it.
To stop ZooKeeper, run the following command:
sudo /opt/apache-zookeeper-3.7.0-bin/bin/zkServer.sh stop
You should see the following output:
ZooKeeper JMX enabled by default
Using config: /opt/apache-zookeeper-3.7.0-bin/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED
Congratulations! You have successfully installed and configured ZooKeeper on MXLinux Latest. ZooKeeper is now ready to be used by your applications for distributed coordination.
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!