1、安装JDK,并设置JAVA_HOME
2、下载并解压zookeeper安装包
3、添加配置文件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.
dataDir=/usr/apps/data/zookeeper
# the port at which the clients will connect
clientPort=2181
server.1=192.168.42.129:2888:3888
server.2=192.168.42.130:2888:3888
server.3=192.168.42.131:2888:3888
4、在dataDir下添加myid文件,本示例中的dataDir为/usr/apps/data/zookeeper。myid里要有相应的值(1-255),如server.1=192.168.42.129:2888:3888,则机器192.168.42.129:/usr/apps/data/zookeeper下myid的内容为1。
5、依次启动zookeeper,即可。
./zkServer.sh start