Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Zookeeper

Shulou Source: shulou.com Published: 2022-06-01 06:27:56 10月04日 Update

Installation

Download the installation package http://www.apache.org/dyn/closer.cgi/zookeeper/ and choose a stable version

Extract the installation package

two。 Create a zoo.cfg in the conf directory (specified by the zkEnv file in the bin directory). Refer to the zoo_sample.cfg file

2.1 stand-alone mode

TickTime=2000dataDir=../datadir/zookeeperdataLogDir=../datalogdir/zookeeperclientPort=2181

2.2 Cluster mode

TickTime=2000dataDir=../datadir/zookeeperdataLogDir=../datalogdir/zookeeperclientPort=2181initLimit=10syncLimit=5server.1=127.0.0.1:8880:3887server.2=127.0.0.1:8881:3888server.3=127.0.0.1:8882:3889

3. Description of common parameters

TickTime is the basic unit of time used by zookeeper in milliseconds

DataDir data directory

DataLogDir log directory

Connection port of the clentPort client

When initLimt is initialized, the heartbeat of the longest connection between follower and leader, such as: 10x tickTime

The longest communication time between syncLimit follower and leader is 5 times tickTime.

Server.id=host:port1:port2

Id is the serial number of each server in the cluster. You need to create a myid file in the dataDir directory and write the serial number.

IP address of each server of host

Communication port between server of port1

Port2 selects the port of leader

4. Log configuration

4.1The zookeeper.root.logger in conf/log4j.properties needs to be modified. The default is console.

4.2 need to modify ZOO_LOG_DIR and ZOO_LOG_PROP specified log directory and appender under bin/zkEnv.sh

4.3 need to modify conf/zoo.cfg to add dataLogDir parameter (I don't know how to use it at the moment)

5. Start

Bin/zkServer.sh or bin/zkServer.cmd

Note: if it is in cluster mode, there will be an error: because other services are not started.

Reference address: https://zookeeper.apache.org/doc/trunk/zookeeperAdmin.html#sc_configuration

Reference address: http://blog.csdn.net/lengzijian/article/details/9226867

Tags: Directory address file log mode port cluster reference maximum unit parameter serial number time communication stand-alone customer commonly used console data version Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Shulou Tech Info Huawei macOS Microsoft