Install and configure ZooKeeper on Linux
download zip file
Copy the compressed file to the specified directory
Excuting an order
tar -zxvf [apache-zookeeper-3.5.7-bin.tar.gz] -C [/opt/module/]
Note: The first bracket is the compressed file name, and the second bracket is the decompression to the specified directory
Go to the unzipped folder and check the directory structure
Enter the conf directory, and you will see a file ending in .cfg, which is the zookeeper configuration file.
Modify the dataDir in the configuration file according to your personal situation.
Configuration Interpretation
- tickTime=2000: Communication heartbeat time, zookeeper server and client heartbeat time, in milliseconds.
- initLimit=10: LF initial communication time limit. The maximum number of heartbeats that the Leader and Foolower can tolerate when they initially connect.
- syncLimit=5: LF synchronous communication time limit.
- dataDir: Save the data in zookeeper. By default, it is stored in the tmp directory, which is easy to be deleted periodically by Linux.
- clientPort=2181: client connection port, usually not modified.
Start the zookeeper server
[root@syi zookeeper-3.5.7]# bin/zkServer.sh start
/usr/bin/java
ZooKeeper JMX enabled by default
Using config: /opt/module/zookeeper-3.5.7/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
start the client
[root@syi zookeeper-3.5.7]# bin/zkCli.sh