Install zookeeper

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


  1. tickTime= 2000    
  2. dataDir=/Users/apple/zookeeper/data    
  3. dataLogDir=/Users/apple/zookeeper/logs    
  4. 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
If you have configured the environment variables, you can use the zookeeper command from any location without entering the bin directory. Such as:  zkServer.sh start. Execute this command directly to start zookeeper

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325472088&siteId=291194637