Download package
Download rmp from apache, find the fast mirror according to your location
Install JDK
Hosts
For each server you want join to the zookeeper cluster:
vi /etc/hosts
192.168.126.150 mesos-master
192.168.126.151 mesos-agent
192.168.126.152 mesos-agent-1
Firewall
Stop firewall or set proper iptables
systemctl disable firewalld
systemctl stop firewalld
Untar your tarball
tar -zxvf ./apache-zookeeper-3.6.2-bin.tar.gz
Config
Set configuration of your cluster servers
vi /conf/zoo.cfg
tickTime=2000
dataDir=/var/lib/zookeeper
clientPort=2181
initLimit=5
syncLimit=2
server.1=mesos-master:2888:3888
server.2=mesos-agent:2888:3888
server.3=mesos-agent-1:2888:3888
Server identifier
Add a file /var/lib/zookeeper/myid on your server, the content 1~255 and should be unique for each server
NOTE: Folder /var/lib/zookeeper/ may not exists before you run zkServer.sh
Initialize cluster
Run command to join the cluster
bin/zkServer.sh start
Verify your installation
bin/zkCli.sh -server mesos-master:2181
get /
create /test
get /
quit