ZooKeeper is the meaning of the zoo administrator, it is used to manage Hadoop (elephant), Hive (Bee), pig (pig) administrator, Apache Hbase, Apache Solr, Dubbo have used the ZooKeeper, in fact, a cluster management tools, is a cluster of entry.ZooKeeper is a distributed, open-source program coordination services, is a subproject of Hadoop project.ZooKeeper main application scenarios include cluster management (master-slave management, load balancing, high availability management), centralized management of configuration files, distributed locks, registration centers.Actual project, in order to ensure high availability, the ZooKeeper are carried out in a manner distributed cluster mounted, at least three nodes, the following specific look at.
Here choose Linux CentOS 7.2.
# Wget -P / usr / local http: // mirror.bit.edu.cn / apache / zookeeper / zookeeper-3.4.10 / zookeeper-3.4.10.tar.gz
# Cd / usr / local
# Tar -zxvf zookeeper-3.4.10.tar.gz
# Cd zookeeper-3.4.10
# Mkdir data
# Mkdir logs
# Vim / etc / rc.d / rc.local // open since the launch configuration
Is added to the following configuration:
export JAVA_HOME = / usr / java / jdk
/ Usr / local / zookeeper-3.4.10 / bin / zkServer.sh start
We deploy a ZooKeeper each process on a different three servers to form a ZooKeeper cluster.Three ZooKeeper process uses the same zoo.cfg Configuration:
# Cd / usr / local / zookeeper-3.4.10 / conf
# Cp zoo_sample.cfg zoo.cfg // copy the configuration file
# Vim zoo.cfg
Modify the configuration is as follows:
# Set the snapshot file storage directory
dataDir = / usr / local / zookeeper-3.4.10 / data
dataLogDir = / usr / local / zookeeper-3.4.10 / logs
# Zk server process listening on TCP port
clientPort = 2181
# 2888: port for communication between the ZooKeeper service, 3888: Port ZooKeeper applications to communicate with other
# Server.1: Indicates that this is the first few numbers server
server.1 = 192.168.20.11: 2888: 3888
server.2 = 192.168.20.12: 2888: 3888
server.3 = 192.168.20.13: 2888: 3888
Then at three servers dataDir directory, create a separate myid file, its contents were 1,2,3.ZooKeeper were then start the process on three machines, so we put ZooKeeper cluster starts up.as follows:
# Cd / usr / local / zookeeper-3.4.10 / data
# Echo 1 >> myid // Create a file and write 1 myid
# / Usr / local / zookeeper-3.4.10 / bin / zkServer.sh start // backstage start ZooKeeper
There are other commands are as follows:
# / Usr / local / zookeeper-3.4.10 / bin / zkServer.sh stop // close ZooKeeper
# / Usr / local / zookeeper-3.4.10 / bin / zkServer.sh status // check the service status
# / Usr / local / zookeeper-3.4.10 / bin / zkServer.sh start-foreground // reception start
That''s all for this article, I want to be helpful to learn, I hope you will support script Home.
You may also be interested in the article: Use Docker Swarm build a distributed crawler cluster approach example Centos7.3 RabbitMQ build a distributed cluster sample PHP memcache set five strategies to implement distributed web cluster session under Linux Kafka method for synchronizing distributed cluster installation instructions for Linux Cluster / distributed processing environment session Detailed Detailed CentOS 6.5 build Redis3.2.8 stand-alone distributed cluster Detailed use docker build hadoop distributed differences and connections Hadoop cluster java stand-alone and distributed and fully distributed cluster (cluster) and install explain distributed cluster architecture of distributed crawlers of crawler technology overview explain