zookeeper安裝 參考:https://www.cnblogs.com/shaozm/p/10141727.html
下載 :
wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz
cd zookeeper-3.4.14
mkdir data
cd conf mv zoo_sample.cfg zoo.cfg vi 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=/home/hadoop/zookeeper-3.4.14/data
dataLogDir=/home/hadoop/zookeeper-3.4.14/log
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
server.1=192.168.91.112:2888:3888
server.2=192.168.91.113:2888:3888
server.3=192.168.91.114:2888:3888
#
# 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
備注: server.1 server.2 server.3 是指三台機器
以下兩個目錄手工創建
dataDir=/home/hadoop/zookeeper-3.4.14/data
dataLogDir=/home/hadoop/zookeeper-3.4.14/log
conf目錄下創建java.env
vi
java.env
export JVMFLAGS="-Xms100m -Xmx300m $JVMFLAGS"
設置每台zoomkeeper 的 id
echo "1" > /home/hadoop/zookeeper-3.4.14/data/myid
做好以上配置 之后將整個zookeeper的目錄遠程拷貝的其他兩台機器上
scp -r /home/hadoop/zookeeper-3.4.14 hadoop@slave1:/home/hadoop/
scp -r /home/haddop/zookeeper-3.4.14 hadoop@slave2:/home/hadoop/
並 修改 data/myid 中的內容為 2 (針對server 2即 113機器配置文件)或 3(針對server即114機器配置文件 3)
啟動 命令(每台機器都啟動)
zookeeper-3.4.14/bin/zkServer.sh start 日志會在啟動目錄下 生成 zookeeper.out
查看狀態命令
zookeeper-3.4.14/bin/zkServer.sh status