Install zookeeper in centos6.5
What is zookeeper?
Zookeeper, a collaborative service for distributed applications, is an open-source implementation of Google's Chubby and a Distributed Coordination Service of Hadoop. It contains a simple primitive set, the service is used for Distributed Application collaboration, so that distributed applications can implement services such as synchronization, configuration maintenance, and cluster-based or named services based on these interfaces.
Zookeeper is a cluster composed of multiple services, one leader and multiple follower. Each server stores a copy of data, and global data is consistent. distributed read/write and update request forwarding are implemented by the leader.
Requests are updated in the order in which they are sent. Update requests from the same client are executed in sequence. Data Update is atomic. A data update is either successful or failed, and the data is globally unique, no matter which server the client is connected to, the data tries to be consistent.
Why use zookeeper?
Most distributed applications require a master, Coordinator, or controller to Manage Sub-processes (such as resources and task allocation) that are physically distributed. Currently, most applications need to develop private coordination programs, A general mechanism is lacking. it is a waste of repeated compilation of Coordination programs, and it is difficult to form a common and scalable coordinator. ZooKeeper: provides a general distributed lock Service to coordinate distributed applications.
Cluster Disaster Tolerance:
As long as there are two available three machines, you can select the leader and provide external services (2n + 1 machine, can accommodate n machines ).
Zookeeper distributed environment:
1. Download Zookeeper from the Zookeeper website. Take zookeeper-3.4.6.tar.gz as an example.
2. [root @ hadoopslave1 ~] # Cd/bin
3, [[root @ hadoopslave1 bin] # tar-zxvf zookeeper-3.4.6.tar.gz
4. [root @ hadoopslave1 bin] # cd zookeeper-3.4.6/conf
5. [root @ hadoopslave1 conf] # vi zoo. cfg (if zoo. cfg does not exist, use zoo_sample.cfg to copy one and rename cp zoo_sample.cfg zoo. cfg)
6. [root @ hadoopslave1 conf] # vi zoo. cfg
TickTime = 2000 initLimit = 10 syncLimit = 5server. 1 = 192.168.0.100: 2888: 3888 (hadoopslave1) server.2 = 192.168.0.200: 2888: 3888 (hadoopslave2) server.3 = 192.168.0.300: 2888: 3888 (hadoopslave3) Note: server. the numbers below are fixed, and the zoo of each machine. cfg must be the same, this number cannot be changed, if there is a new slave, the number is increased to clientPort = 2181 dataDir =/bin/zookeeper-3.4.6/data (if the folder data does not exist, manually create)
7, Vi/bin/zookeeper-3.4.6/data/myid in 192.168.0.100 (hadoopslave1) Put 1 install one, and scp-r/bin/zookkeper-3.4.6 root @ hadoopslave2: /bin/is the cluster settings (do not forget to modify the environment variables) Vi/bin/zookeeper-3.4.6/data/myid in 192.168.0.200 (hadoopslave2) Put 2 scp-r/bin/zookkeper-3.4.6 root @ hadoopslave3: /bin/Vi/bin/zookeeper-3.4.6/data/myid in 192.168.0.300 (hadoopslave3) Put 3 so that the ZOOKEEPER cluster has been installed and configured completely 7. under the deployment directory of ZOOKEEPER, run the following command on each node: [root @ hadoopslave1 zookeeper-3.4.8] # bin/zkServer. sh start on each node through the following command to view the zookeeper status, whether the normal start: [root @ hadoopslave1 zookeeper-3.4.8] # bin/zkServer. sh status 8. run the JPS command to view the service process QuorumPeerMain.