创建目录
mkdir /data/bigdata/zookeeper -p
chown hadoop:hadoop /data/bigdata/zookeeper -R
修改配置
mv zoo_sample.cfg zoo.cfg
vim zoo.cfg
# 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=/data/bigdata/zookeeper
# 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
#
# 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=master:2888:3888
server.2=node1:2888:3888
server.3=node2:2888:3888
编辑server id
vim /data/bigdata/zookeeper/myid
按服务器编号 依次输入1,2,3
(The myid file consists of a single line containing only the text of that machine's id. So myid of server 1 would contain the text "1" and nothing else. The id must be unique within the ensemble and should have a value between 1 and 255)
拷贝到其他机器
scp -r root@master:/opt/apps/zookeeper-3.4.13 ./
环境变量
#zookeeper
export ZOOKEEPER_HOME="/usr/lib/zookeeper-current"
#set zookeeper log dir
export ZOO_LOG_DIR="/data/bigdata/log/zookeeper"
if [[ -n $ZOOKEEPER_HOME ]]; then
export PATH=$ZOOKEEPER_HOME/bin:$PATH
fi
cd /usr/lib &&ln -s /opt/apps/zookeeper-3.4.13 zookeeper-current
网友评论