Zookeeper: различия между версиями

Материал из Home Wiki
Перейти к навигации Перейти к поиску
Строка 6: Строка 6:
# создаем файл /var/zookeeper/myid с номером X
# создаем файл /var/zookeeper/myid с номером X
# запускаем /opt/zookeeper<Version>/bin/zkServer.sh start
# запускаем /opt/zookeeper<Version>/bin/zkServer.sh start
== zoo.cfg ==
<syntaxhighlight>
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/var/zookeeper
# the port at which the clients will connect
clientPort=2183
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
autopurge.purgeInterval=1
server.1=192.168.1.8:2889:3889
server.2=192.168.1.7:2889:3889
server.3=192.168.1.6:2889:3889
</syntaxhighlight>


== Сервис в CentOS ==
== Сервис в CentOS ==

Версия 07:57, 31 мая 2018

Настройка

  1. Разворачиваем zookeper в /opt
  2. Создаем /var/zookeeper
  3. Создаем /opt/zookeeper<Version>/conf/zoo.cfg из zoo_sample.cfg.
    Добавляем в него server.X и ID, меяем dataDir на /var/zookeeper
  4. В log4j.properties меняем zookeeper.log.dir=/var/log и zookeeper.tracelog.dir=/var/log
  5. создаем файл /var/zookeeper/myid с номером X
  6. запускаем /opt/zookeeper<Version>/bin/zkServer.sh start

zoo.cfg

# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/var/zookeeper
# the port at which the clients will connect
clientPort=2183
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
autopurge.purgeInterval=1
server.1=192.168.1.8:2889:3889
server.2=192.168.1.7:2889:3889
server.3=192.168.1.6:2889:3889

Сервис в CentOS

Добавляем в zkServer.sh

# Comments to support chkconfig on RedHat Linux
# chkconfig: 2345 64 36
# description: Zookeeper

и добавить после ZOOBINDIR="$(cd "${ZOOBIN}"; pwd)"

# UPDATE PATHS
ZOOBIN=/opt/zookeeper-3.4.12/bin
ZOOBINDIR=/opt/zookeeper-3.4.12/bin


cd /etc/init.d
ln -s /opt/zookeeper-3.4.12/bin/zkServer.sh  /etc/init.d/zookeeper  
chkconfig --add zookeeper
service zookeeper start