服务器IP | 服务器名称 |
|---|---|
192.168.183.153 | server1 |
192.168.183.154 | server2 |
192.168.183.155 | server3 |
每台zookeeper都需要有下面的操作:
[root@localhost opt]# cd /usr/local
[root@localhost local]#rz -E #上传jdk
rz waiting to receive.
[root@localhost local]#tar -zxvf apache-zookeeper-3.6.4-bin.tar.gz #解压
[root@localhost local]#mv apache-zookeeper-3.6.4-bin zookeeper
[root@localhost local]# cd zookeeper/
[root@localhost zookeeper]# mkdir data #创建数据目录
[root@localhost zookeeper]# mkdir logs #创建日志目录
[root@localhost zookeeper]# ls
bin conf data docs lib LICENSE.txt logs NOTICE.txt README.md README_packaging.md
[root@localhost zookeeper]# cd conf
[root@localhost conf]# ls
configuration.xsl log4j.properties zoo_sample.cfg
[root@localhost conf]# mv zoo_sample.cfg zoo.cfg
[root@localhost conf]# vim zoo.cfg #修改配置文件
# The number of milliseconds of each tick
tickTime=2000 #通信心跳时间,zookeeper服务器与客户端心跳时间,毫秒
# The number of ticks that the initial
# synchronization phase can take
initLimit=10 #Leader和Follower初始连接时能容忍的最多心跳数(tickTime的数量),这里表示为10*2s
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5 #Leader和Follower之间同步通信的超时时间,这里表示如果超过5*2s,Leader认为Follwer死掉,并从服务器列表中删除Follwer
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/usr/local/zookeeper/data 修改,指定保存Zookeeper中的数据的目录,目录需要单独创建
dataLogDir=/usr/local/zookeeper/logs 添加,指定存放日志的目录,目录需要单独创建
# the port at which the clients will connect
clientPort=2181 #客户端连接端口
# 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
# Metrics Providers
# https://prometheus.io Metrics Exporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true
#添加集群信息
server.1=192.168.183.153:3188:3288
server.2=192.168.183.154:3188:3288
server.3=192.168.183.155:3188:3288
root@localhost zookeeper]# cd bin
[root@localhost bin]# ls
README.txt zkCli.cmd zkEnv.cmd zkServer.cmd zkServer.sh zkSnapShotToolkit.sh zkTxnLogToolkit.sh
zkCleanup.sh zkCli.sh zkEnv.sh zkServer-initialize.sh zkSnapShotToolkit.cmd zkTxnLogToolkit.cmd
[root@localhost bin]# ./zkServer.sh start #启动zookeeper
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。