Download the installation package: http://mirror.bit.edu.cn/apache/zookeeper
wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.5.6/apache-zookeeper-3.5.6.tar.gz
Note: Before installing zk make sure the three machines to be deployed are already installed JDK.
zk service management implementation model: registry, producers, consumers, registry registered all information about the simple production of consumers who want to achieve is to manage the service, we must know which machine to provide what services, who to turn to, also mapping relationship between what ip mapping service,
zk can be detected through the heartbeat mechanism hang machine and hang the machine ip and services corresponding relationship deleted from the list
tar -xvf apache-zookeeper-3.5.6.tar.gz && cd apache-zookeeper-3.5.6.tar.gz/conf
Copy this file to the zoo_sample.cfg zoo.cfg (must be the file name):
cp zoo_sample.cfg zoo.cfg
zoo.cfg of parameters:
Open zoo.cfg, you can see some of the default configuration.
- tickTime
length in milliseconds, the basic unit of time measurement zk used. For example, 1 * tickTime heartbeat time zk client and server-side, 2 * tickTime a client session timeout.
The default value is 2000 milliseconds tickTime, lower values tickTime timeout issues can be found more quickly, but will lead to higher network traffic (heartbeat message) and higher CPU usage (session tracking processing). - clientPort
ZK server process listening on TCP port, by default, the server listens on 2181 port. - dataDir
no default configuration, you must configure, store directory configuration snapshot files. If no dataLogDir , then transaction logs will be stored in this directory; Note: If you want to configure a cluster, please add the server ip in clientPort below
Note: If you want to configure a cluster, please add the server ip in clientPort below
server.1 = 192.168.110.151: 2888: 3888
server.2 = 192.168.110.152: 2888: 3888
server.3 = 192.168.110.153: 2888: 3888
I came zoo.cfg
Modify the three: