Zookeeper installation and configuration
1. Environment configuration
Upload the installation package to CentOS, unzip the installation package to the hadoop directory
tar -zxvf apache-zookeeper-3.5.7-bin.tar.gz -C /usr/hadoop
mv apache-zookeeper-3.5.7-bin/
Renamed to zookeeper-3.5.7,
modify the Zookeeper configuration file under its conf
cp zoo_sample.cfg zoo.cfg
tickTime=2000
clientPort=2181
initLimit=5
syncLimit=2
dataDir=/usr/hadoop/zookeeper-3.5.7/zkdata
#zkdata这个需要自己创建一下
# 节点数为单数(投票机制)
server.0=node1:2888:3888
server.1=node2:2888:3888
server.2=node3:2888:3888
Send zoo.cfg file to node2 and node3
scp -r /usr/hadoop/zookeeper-3.5.7 node2:/usr/hadoop/zookeeper-3.5.7
scp -r /usr/hadoop/zookeeper-3.5.7 node3:/usr/hadoop/zookeeper-3.5.7
Create a myid file under the /zookeeper-3.5.7/zkdata path on the node1, node2, and node3 respectively, and fill in the value behind the respective server. Take node1r as an example:
vi myid
0
Configure environment variables
vi /etc/profile
Add the following code at the end, save and exit
export ZOOKEEPER_HOME=/usr/hadoop/zookeeper-3.5.7
export PATH=$ZOOKEEPER_HOME/bin:$PATH
Send the /etc/profile configuration file to node2 and node3
scp -r /etc/profile node2:/etc/profile
scp -r /etc/profile node3:/etc/profile
Effective configuration on node1, node2, and node3 respectively
source /etc/profile
2. Start Zookeeper
Start Zookeeper on node1, node2, and node3 respectively
zkServer.sh start
Check the Zookeeper status on the nodes respectively,
one leader and two followers
zkServer.sh status