1.下载zookeeper
首先在apache官网上下载zookeeper安装包,这里下载的是zookeeper-3.5.2-alpha版本
2.配置zoo.cfg文件
在conf文件夹下,copy文件zoo_sample.cfg,并重新命名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=/usr/local/software/zookeeper-3.5.1-alpha/data
# 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
3.配置zookeeper的环境变量
# Setting Zookeeper
export ZOOKEEPER_HOME=/usr/local/software/zookeeper-3.5.2-alpha
export PATH=${PATH}:${ZOOKEEPER_HOME}/bin
export ZOO_LOG_DIR=${ZOOKEEPER_HOME}/log