ZooKeeper

Instalando o ZooKeeper 3.4.10 no CentOS 7 1611

Baixando o ZooKeeper 3.4.10

# curl -O http://ftp.unicamp.br/pub/apache/zookeeper/stable/zookeeper-3.4.10.tar.gz

Instalando o ZooKeeper 3.4.10

# tar zxvf zookeeper-3.4.10.tar.gz
# mv zookeeper-3.4.10 /opt/zookeeper-3.4.10
# ln -s /opt/zookeeper-3.4.10 /opt/zookeeper

Criando o arquivo de serviço

# tee /etc/systemd/system/zookeeper.service <<-'EOF'
[Unit]
Description=Zookeeper
After=syslog.target

[Service]
SyslogIdentifier=zookeeper
TimeoutStartSec=10min
Type=forking
ExecStart=/opt/zookeeper/bin/zkServer.sh start
ExecStop=/opt/zookeeper/bin/zkServer.sh stop

[Install]
WantedBy=multi-user.target
EOF

Criando o arquivo de identificação

# mkdir /var/lib/zookeeper
# echo "1" > /var/lib/zookeeper/myid

Para um servidor standalone

# tee /opt/zookeeper/conf/zoo.cfg <<-'EOF'
tickTime=2000
dataDir=/var/lib/zookeeper
clientPort=2181
EOF

Para replicação com vários nós

# tee /opt/zookeeper/conf/zoo.cfg <<-'EOF'
tickTime=2000
dataDir=/var/lib/zookeeper
clientPort=2181
initLimit=5
syncLimit=2
server.1=zoo1:2888:3888
server.2=zoo2:2888:3888
server.3=zoo3:2888:3888
EOF

Iniciando o serviço

# service zookeeper start

Ativando na inicialização

# chkconfig zookeeper on

Referências

https://zookeeper.apache.org/doc/trunk/zookeeperStarted.html#sc_Download