您的位置:首页 > 其它

zookeeper 集群安装

2016-02-19 11:54 1481 查看
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台服务器宕机。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: