Zookeeper:
1. It can be used as a cluster management tool.
2, can centrally manage configuration files.
1.1.1. Installation of Zookeeper
Installation Environment:
Linux:centos6.4
Jdk: Version 1.7 and above
Zookeeper is developed in java and can run in windows and linux environments. jdk needs to be installed first.
installation steps:
Step 1: Install jdk
Step 2: Upload the compressed package of zookeeper to the Linux system.
Step 3: Unzip the compressed package
tar -zxvf zookeeper-3.4.6.tar.gz
Step 4: Enter the zookeeper-3.4.6 directory and create a data folder.
cd zookeeper-3.4.6/conf/
Step 5: Rename zoo_sample.cfg to zoo.cfg
[root@localhost conf]# mv zoo_sample.cfg zoo.cfg
Step 6: Edit zoo.cfg and modify the data attribute:
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/home/hao/zookeeper-3.4.6/data
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
Step 7: Start zookeeper
[root@localhost bin]# ./zkServer.sh start
closure:
[root@localhost bin]# ./zkServer.sh stop
Check status:
[root@localhost bin]# ./zkServer.sh status
Note: Firewall needs to be turned off.
service iptables stop
Permanently close and modify the configuration to start the firewall without starting:
chkconfig iptables off
If you cannot start zookeeper successfully, you need to delete the zookeeper_server.pid file in the data directory.