1. Unzip the zookeeper installation package
2. Configure environment variables
Go to etc and modify the profile file
vim /etc/profile
Add the following:
export ZOOKEEPER_HOME=/home/liyuan168/mytool/zookeeper-3.3.6
export PATH=$PATH:$JAVA_HOME/bin :$ZOOKEEPER_HOME/bin:$PATH
Reload the configuration file.
source /etc/profile
3. Configure the configuration file
- tickTime= 2000
- dataDir=/Users/apple/zookeeper/data
- dataLogDir=/Users/apple/zookeeper/logs
- clientPort=4180
- ickTime: The basic time unit used in zookeeper, in milliseconds.
- dataDir: The data directory. Can be any directory.
- dataLogDir: log directory, which can also be any directory. If this parameter is not set, the same settings as dataDir will be used.
- clientPort: The port number that listens for client connections. The address port registered by the producer
So far, the stand-alone mode of zookeeper has been configured. To start the server, just run the script:
ZooKeeper service command:
After preparing the corresponding configuration, you can directly use the zkServer.sh script to perform service-related operations
- 1. Start the ZK service: sh bin/zkServer.sh start
- 2. Check the ZK service status: sh bin/zkServer.sh status
- 3. Stop the ZK service: sh bin/zkServer.sh stop
- 4. Restart the ZK service: sh bin/zkServer.sh restart