Zookeeper Single-node construction
1. Upload this zookeeper-3.4.5.tar.gz file to the/usr/local directory on the server
2. Decompression: TAR-ZXVF zookeeper-3.4.5.tar.gz
3. Renaming: MV zookeeper-3.4.5 zookeeper
4.CD zookeeper/conf
5. Modify the configuration file name: MV Zoo_sample.cfg zoo.cfg
6.cd..
7. Starting zookeeper:bin/zkserver.sh Start
8. Verify: JPS, as long as you can see that the process (Quorumpeermain) indicates that zookeeper has started normally
9. Then start the Zookeeper client, enter the Zookeeper command: bin/zkcli.sh
A few simple commands: The remaining commands are viewed with the help parameter
LS/view all nodes under the root directory
Create/name Hu creates a node in the root directory the name content is Hu
Start Zookeeper cluster mode
Multiple servers are required, it is recommended to use odd servers,
In this use three, the server IP is: 192.168.1.170 192.168.1.171 192.168.1.172
1: Do these operations on the 192.168.1.170 server and put this zookeeper-3.4.5.tar.gz file on?
2: Unzip: TAR-ZXVF zookeeper-3.4.5.tar.gz
3: Rename: MV zookeeper-3.4.5 zookeeper
4:CD zookeeper/conf
5: Modify the configuration file name: MV Zoo_sample.cfg zoo.cfg
6:vi zoo.cfg
Modifying datadir:/usr/local/zookeeper/data in a configuration file
Add the following configuration:
server.0=192.168.1.170:2888:3888
server.1=192.168.1.171:2888:3888
server.2=192.168.1.172:2888:3888
7:CD.
8: Create directory mkdir data
9: Create file VI myID in the data directory, save the number of the current node in it
Note: The number saved on the 192.168.1.170 server is 0
10:cd/usr/local
11: Copy the Zookeeper directory on the 170 server to the other two nodes
SCP-RQ Zookeeper 192.168.119.101:/usr/local
SCP-RQ Zookeeper 192.168.119.102:/usr/local
12: Connect to 192.168.1.171,cd/usr/local/zookeeper/data modify myID in the number 1
13: Connect to 192.168.1.172,cd/usr/local/zookeeper/data modify myID in the number 2
14: Start the Zookeeper service above the three nodes
Execute command in/usr/local/zookeeper directory on 170: bin/zkserver.sh Start
Execute command in/usr/local/zookeeper directory on 171: bin/zkserver.sh start
Execute command in/usr/local/zookeeper directory on 172: bin/zkserver.sh start
15: Finally, each node is executed JPS Verify that the process starts normally.
Zookeeper single-node construction and distributed construction