Configuration details of zookeeper installation on a single machine in Linux
Install Zookeeper
Zookeeper is installed in three modes: Standalone mode, cluster mode, and pseudo cluster mode.
1. Download
To download the object, select .tar.gz.
Environment: Centos7, JDK1.8
2. Installation
Use tar to decompress the directory to be installed. Take version 3.5 as an example.
[Root @ localhost conf] # tar-zxf zookeeper-3.5.0-alpha.tar.gz
3. Configuration
Create data and logs directories in the main directory to store data and logs:
[Root @ localhost zookeeper] # mkdir data
[Root @ localhost zookeeper] # mkdir logs
Create a zoo. cfg file in the conf directory,
[Root @ localhost conf] # mv zoo_sample.cfg zoo. cfg
[Root @ localhost conf] # vi zoo. cfg
tickTime=2000initLimit=10syncLimit=5dataDir=/home/svr/application/zookeeper/datadataLogDir=/home/svr/application/zookeeper/logsclientPort=2181
4. Start and Stop
Enter the bin directory, start, stop, restart, and view the current node status (including the roles in the cluster). Do not execute:
[Root @ localhost bin] #./zkServer. sh start
[Root @ localhost bin] #./zkServer. sh stop
[Root @ localhost bin] #./zkServer. sh restart
[Root @ localhost bin] #./zkServer. sh status
5. Client connection:
[Root @ localhost bin] #./zkCli. sh-server 192.168.24.250: 2181