# Download archive
wget https://archive.apache.org/dist/zookeeper/zookeeper-3.5.5/apache-zookeeper-3.5.5-bin.tar.gz
# Unzip to a specific directory
tar -xzvf apache-zookeeper-3.5.5-bin.tar.gz -C $install_dir
# Copy the configuration file
cp $install_dir/conf/zoo_sample.cfg zk1.cfg cp $install_dir/conf/zoo_sample.cfg zk2.cfg cp $install_dir/conf/zoo_sample.cfg zk3.cfg
# Modify the configuration file
## zk1.cfg
tickTime=2000 initLimit=10 syncLimit=5 dataDir=....../data/2181 dataLogDir=....../log/2181 clientPort=2181 #maxClientCnxns=60 #autopurge.purgeInterval=1 server.1=127.0.0.1:2181:3881 server.2=127.0.0.1:2182:3882 server.3=127.0.0.1:2183:3883
## zk2.cfg
tickTime=2000 initLimit=10 syncLimit=5 dataDir=....../data/2182 dataLogDir=....../log/2182 clientPort=2182 #maxClientCnxns=60 #autopurge.purgeInterval=1 server.1=127.0.0.1:2181:3881 server.2=127.0.0.1:2182:3882 server.3=127.0.0.1:2183:3883
## zk3.cfg
tickTime=2000 initLimit=10 syncLimit=5 dataDir=....../data/2183 dataLogDir=....../log/2183 clientPort=2183 #maxClientCnxns=60 #autopurge.purgeInterval=1 server.1=127.0.0.1:2181:3881 server.2=127.0.0.1:2182:3882 server.3=127.0.0.1:2183:3883
# Create a file myid
echo 1 > ....../data/2181/myid echo 2 > ....../data/2182/myid echo 3 > ....../data/2183/myid
# Enable pseudo cluster
$install_dir/bin/zkServer.sh start zk1.cfg $install_dir/bin/zkServer.sh start zk2.cfg $install_dir/bin/zkServer.sh start zk3.cfg