Install Zookeeper:
: http://mirror.bit.edu.cn/apache/zookeeper/
The ZK node is preferably an odd number, which makes it easy to select the leader node in the node;
Upload the zookeeper-3.4.10 installation package to the/software directory:
TAR-ZXVF zookeeper-3.4. Ten
Decompression to the/software;
Enter zookeeper-3.4.10 create folder data;
Mkdir-p/software/zookeeper-3.4. Ten/data
Create file myID under Data, content is 1;
" 1 ">>/software/zookeeper-3.4. Ten/data/myid
Enter conf, copy a zoo_sample.cfg named zoo.cfg;
CP Zoo_sample.cfg Zoo.cfg
Modify ZOO.CFG Content:
datadir=/software/zookeeper-3.4. Ten/data
#这里是zookeeper快照目录, recommendations based on actual modifications
The last line is added:
Format: Server.serverid=hostname:lfport:txport
# ServerID is the ID number of the ZK node
# hostname is host name
# Lfport is the communication port between leader and follower (default 2888)
# Txport is an election leader communication port between follower (default 3888)
Server. 1=slave01:2888:3888 #server. 1 in 1 is the ID, followed by the hostname and port number server. 2=salve02:2888:3888server. 3=slave03:2888:3888
Then change the permissions of the zookeeper-3.4.10 folder to Hadoop;
Chown-r hadoop:hadoop/software/zookeeper-3.4. Ten
Other node installation simply copy the entire zookeeper-3.4.10 directory to the same folder as the other nodes/software below, and modify the myID file under data to the respective ID:
Scp-r Hadoop1:/hadoop/zookeeper
"2" >/software/zookeeper-3.4.10/data/myid
For convenience, you can add the zookeeper executable directory to the PATH environment variable:
path=/software/zookeeper-3.4. ten/bin;
/software/zookeeper-3.4.10/bin directory on each node, respectively
Start./zkserver.sh start;
View the startup status./zkserver.sh status
Stop./zkserver.sh stop
Using JPS to view the process will be more than: Quorumpeermain
Use Zkcli.sh-server Ip:port to connect to the zookeeper cluster with the following syntax:
127.0. 0.1:2181
Use Help to view relevant assistance;
[zk:127.0.0.1:2181 (CONNECTED) 0-server host:port cmd args connect host:port get path [watch] ls Path [watch] set path data [version] RMR path delquota [-n|-b] path quit Printwatcheson | off Create [-S] [-e] path data ACL stat path [watch] close ls2 path [watch] History Listquota path setacl path ACL getacl path sync path redo Cmdno addauth scheme Auth Delete path [version] -n|-b Val Path
Linux installation Configuration zookeeper-3.4.10