GNU/Linux Zookeeper Get Started Guide
This tutorial will guide you step-by-step on How to Getting-Started with Apache Zookeeper in GNU/Linux Systems.
And ZooKeeper for Linux allows distributed Processes to coordinate with each other through a shared hierarchal Namespace which is organized similarly to a standard File System.
The Name Space consists of Data Registers – called Znodes, in ZooKeeper parlance – and these are similar to Files & Directories.
Unlike a typical File System, which is designed for storage, ZooKeeper Data is kept In-memory, which means ZooKeeper can acheive High Throughput and Low Latency numbers.
1. Installing Zookeeper
How to Install Zookeeper on GNU/Linux
2. Setting up Target
Making the Zookeeper Data Directory
With:sudo su -c "mkdir /var/lib/zookeeper"
3. Configuring
Creating the Zookeeper Configuration File
Access the Target:cd /opt/zookeeper
And make it with the nano Editor:sudo su -c "nano conf/zoo.cfg"
Append for Example:tickTime=2000 dataDir=/var/lib/zookeeper clientPort=2181
tickTime: the basic time unit in milliseconds used by ZooKeeper. It is used to do heartbeats and the minimum session timeout will be twice the tickTime.
Ctrl+x to Save & Exit from nano Editor :)4. Starting Server
To Start Up the Zookeeper Server
Run:sudo bin/zkServer.sh start
5. Connecting to Server
So to Connect by Java Client to Zookeeper Server
So to Connect:bin/zkCli.sh -server 127.0.0.1:2181
The Zookeeper Shell Prompt:[zkshell: 0]
6. Exploring
Now to Explore Zookeeper Shell.
Showing Up Commands:[zkshell: 0] help
Create a Z-Node:[zkshell: 0] create /zk_node my_data
Listing the Z-Nodes:[zkshell: 0] ls /
Showing the Data Associated to a Z-Node:[zkshell: 0] get /zk_node
The Output will Show up: “my_data” as First, entry.
Changing the Data Associated to a Z-Node:[zkshell: 0] set /zk_node hello
Deleting a Z-Node:[zkshell: 0] delete /zk_node
7. Learning
For More See Zookeeper Programmers Docs