ZooKeeper server administration tools¶
ZooKeeper provides command-line scripts to manage and interact with the server service. The primary script for controlling the server lifecycle is zkServer.sh, while zkCli.sh is used for client interactions and runtime inspection^[600-developer-big-data-zookpeeper-zookpeeeper-01.md].
Server Management (zkServer.sh)¶
The zkServer.sh script is used to start, check the status of, and stop the ZooKeeper server^[600-developer-big-data-zookpeeper-zookpeeeper-01.md].
Common commands include:
* Start: bin/zkServer.sh start
* Status: bin/zkServer.sh status
* Stop: bin/zkServer.sh stop^[600-developer-big-data-zookpeeper-zookpeeeper-01.md]
Administrators can also verify that the process is running using the jps command^[600-developer-big-data-zookpeeper-zookpeeeper-01.md].
Configuration¶
Before starting the server, it must be properly configured. The default configuration usually requires copying the sample configuration file to the active configuration file^[600-developer-big-data-zookpeeper-zookpeeeper-01.md].
cp /opt/zookeeper/conf/zoo_sample.cfg /opt/zookeeper/conf/zoo.cfg
Key Parameters¶
The zoo.cfg file defines critical operational parameters:
* clientPort: The port listening for client connections (default is 2181).^[600-developer-big-data-zookpeeper-zookpeeeper-01.md]
* dataDir: The directory where the snapshot is stored.^[600-developer-big-data-zookpeeper-zookpeeeper-01.md]
In a clustered setup, additional parameters such as initLimit, syncLimit, and a list of cluster peers (e.g., server.1=zoo1:2888:3888) are required^[600-developer-big-data-zookpeeper-zookpeeeper-01.md].
Cluster Identity (myid)¶
For a multi-server (clustered) setup, each server requires a unique identifier. This is configured by creating a file named myid in the directory specified by the dataDir parameter^[600-developer-big-data-zookpeeper-zookpeeeper-01.md].
Related Concepts¶
- ZooKeeper
- [[Cluster configuration]]
Sources¶
- 600-developer-big-data-zookpeeper-zookpeeeper-01.md