zookeeper 集群安装

来源:互联网 发布:淘宝刷客被警察抓 编辑:程序博客网 时间:2024/06/16 02:06

1 官网下载

http://www.eu.apache.org/dist/zookeeper/zookeeper-3.4.6/

下载zookeeper-3.4.6.tar.gz

解压到系统任意目录

2.配置\zookeeper-3.4.6\conf\zoo_sample.cfg 改名为 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=/tmp/zookeeper

dataLogDir=/tmp\logs\zookeeper
# 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


3.集群配置

需要在 zoo.cfg后追加

server.1=192.168.1.101:2888:3888
server.2=192.168.1.102:2888:3888
server.3=192.168.1.103:2888:3888

dataDir目录下创建myid文件。

192.168.1.101节点中写入1

192.168.1.102节点中写入2

192.168.1.103节点中写入3

4.启动

zookeeper-3.4.6/bin 目录下

三台机器下分

执行zkServer.cmd start(window)

执行zkServer.sh start(linux)


搭建完毕~~~ 三个节点可以允许有一台停止服务,推荐用5台机器。允许有2台服务器宕机。

0 0
原创粉丝点击