Learn a zookeeper

1. What is the zookeeper?

Official website: ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services .

Coordination of services is a simple point is zookeeper distributed services

zookeeper manage distributed services

zookeeper's design goals: easy to use, reusability, fast ..

For details, please see the official document: http: //zookeeper.apache.org/doc/current/zookeeperOver.html

2. Installation standalone mode

1) to view the conf directory there is a zoo_sample.cfg, he will change into a zoo.cfg

mv ./zoo_sample.cfg ./zoo.cfg

2) Edit zoo.cfg

# Basic time unit interaction between the server and the client (ms)

tickTime=2000

# Save the zookeeper data

dataDir = / home / java / apache-zookeeper-3.5.5 / data (their specified directory)

The number of clients # zookeeper acceptable

initLimit = 5

# Between server and client requests and response time interval

syncLimit=2 

# Client and interact with one another zookeeper port

clientPort = 2181

server1=master:2888:3888

Explanation:

We only started on a single machine

3) You can configure environment variables zookeeper

vim  /etc/profile

#zookeeper

export ZOOKEEPER=/home/hadoop/zookeeper-3.4.10

export PATH=$PATH:$ZOOKEEPER/bin

Refresh variables

source /etc/profile

4) Start zookeeper

Came to the bin directory

Execution ./zkServer.sh start

See how it works with the jps command java program

The program found no zookeeper

来到目录的logs目录下查看日志

在zookeeper根目录下执行mvn install -DskipTests

再次执行./zkServer.sh start

 3.连接zookeeper

目录下执行bin/zkCli.sh

简单的体验一下zookeeper

 

Guess you like

Origin www.cnblogs.com/ku-ku-ku/p/10974302.html