Download package

Download rmp from apache, find the fast mirror according to your location

Install JDK

JDK安装
CentOS 7.2.1511 + JDK1.8.0_131环境:Distributor ID: CentOSDescription: CentOS Linux release 7.2.1511 (Core)Release: 7.2.1511 下载地址http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html下载rpm包到本地 安装rpm -ivh jdk-8u131-linux-x64.rpm 环境变量配置vi /etc/profile 加入以下配置: exp…

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