官网下载
wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.6.2/apache-zookeeper-3.6.2-bin.tar.gz
配置
修改${zookeeperhome}/conf/zoo.cfg
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/bigdata/binfile/zookeeper-3.5.8/data
# the port at which the clients will connect
clientPort=2181
clientPortAddress=0.0.0.0
admin.serverPort = 2183
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
quorumListenOnAllIPs=true
4lw.commands.whitelist=*
server.0=master:2888:3888
server.1=slave1:2888:3888
server.2=slave2:2888:3888
在配置的dataDir下
vi myid
配置数字对应起来,这边master是0,slave1是1,slave2是2
复制到子节点
scp -r ./zookeeper hadoop@slave1:/app/
修改对应的myid
启动
# 三台机器都要启动,按顺序启动,有选举机制
./bin/zkServer.sh start
# 全部启动后,测试
./bin/zkServer.sh status
会显示Mode: leader/follower
# 全部启动后,测试
jps 出现QuorumPeerMain
echo ruok|nc master 2181
显示imok
# 客户端连接
./bin/zkCli.sh -server master:2181
博主公众号
求关注