Zookeeper is a full-fledged subproject of Hadoop, a reliable coordination system for large distributed systems, with features such as configuration maintenance, name services, distributed synchronization, group services, and so on. Zookeeper's goal is to encapsulate complex and error-prone key services, delivering easy-to-use interfaces and high-performance, functionally stable systems to users.
1. Install JDK
Steps omitted, not clear Baidu a bit.
2. Configure 2 sets of zookeeper services cluster
Preparation environment: 2 Linux Services 192.168.36.91 and 192.168.36.127
Create a user zookeeper on the 192.168.36.91 and switch to the user directory:
(1) Download: wget http://apache.fayea.com/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz
Decompression TAR-ZXVF zookeeper-3.4.6.tar.gz
(2) Create data, log directory
cd/home/zookeeper/zookeeper-3.4.6
mkdir data
mkdir logs
(3) Modify the configuration file
CD conf/
CP Zoo_sample.cfg Zoo.cfg
VI zoo.cfg
The configuration is as follows:
ticktime=2000
initlimit=10
synclimit=5
#数据目录
datadir=/home/zookeeper/zookeeper-3.4.6/data
#日志目录
datalogdir=/home/zookeeper/zookeeper-3.4.6/logs
clientport=2181
#集群配置
server.1= 192.168.36.91:2888:3888
server.2=192.168.36.127:2888:3888
Other configuration please refer to the official website
(4) Set myID
Under the data directory we created, create a myID file that contains a number that identifies the current host, conf/zoo.cfg the number of x in the server.x configured in the file, and then the number is entered in the myID file.
echo "1" >/home/zookeeper/zookeeper-3.4.6/data/myid
Another service 192.168.36.127 installation is similar, the difference is that the myID input is 2
(5) Startup, shutdown, view status
./bin/zkserver.sh Start
./bin/zkserver.sh Stop
./bin/zkserver.sh Status
To view service registration:
Command line: (For more information: http://zookeeper.apache.org/doc/r3.3.3/zookeeperAdmin.html)
Telnet 192.168.36.91 2181
Dump
or echo Dump | NC 192.168.36.91 2181
(6) Meet the problem
Unable to connect after startup, Telnet 192.168.36.127 2181 prompt: "No route to host" (Install is virtual machine, use Bridge way), route is not up to, use: iptables-f Clear routing rules or turn off iptables (command: Service iptables stop)
3, Configuration Monitoring
Consider using the Taobao Taokeeper
Https://github.com/alibaba/taokeeper
Https://github.com/alibaba/taokeeper/downloads
Use reference:
http://jm-blog.aliapp.com/?p=1450
http://sofar.blog.51cto.com/353572/1298468
4. Management Tools
(1) Zookeeper-web-Online zookeeper management tools
Zookeeper-web is a simple and convenient zookeeper management tool. I'm tired of managing zookeeper from the command line, and I need a tool that I'm familiar with to develop. I borrowed from GitHub's previous management tool written in Python (sorry, I didn't find the address for this project later).
Use the mainstream SPRINGMVC, Freemarker, Bootstrap and zkclient to develop.
Address: Https://git.oschina.net/crystony/zookeeper-web
(2) Node-zk-browser Web management interface developed using Node.js
Address: Https://github.com/killme2008/node-zk-browser
Installation: http://www.rigongyizu.com/node-zookeeper-browser-install/