[心缘地方]同学录
首页 | 功能说明 | 站长通知 | 最近更新 | 编码查看转换 | 代码下载 | 常见问题及讨论 | 《深入解析ASP核心技术》 | 王小鸭自动发工资条VBA版
登录系统:用户名: 密码: 如果要讨论问题,请先注册。

[整理]zookeeper集群安装设置

上一篇:[备忘]activeMq使用failover连接时,特别慢的问题
下一篇:[备忘]activeMq+zookeeper,实现主从结构

添加日期:2016/11/17 15:02:52 快速返回   返回列表 阅读1916次

3台服务器:
192.168.1.116
192.168.1.117
192.168.1.118

以192.168.1.116为例

(1)执行以下命令:
cd /data/env
wget http://mirrors.cnnic.cn/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz
tar -zxvf zookeeper-3.4.6.tar.gz
cd zookeeper-3.4.6/
mkdir data
mkdir dataLog

(2)上传zoo.cfg文件到/data/env/zookeeper-3.4.6/conf/目录下
内容如下:


# 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=/data/env/zookeeper-3.4.6/data
dataLogDir=/data/env/zookeeper-3.4.6/dataLog

# 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


server.1=192.168.1.116:2888:3888
server.2=192.168.1.117:2888:3888
server.3=192.168.1.118:2888:3888




(3)执行以下命令:
cd /data/env/zookeeper-3.4.6/data
echo 1 > myid

(4)将/data/env/zookeeper-3.4.6/目录复制到192.168.1.117的同样目录下,
修改/data/env/zookeeper-3.4.6/data/myid文件,内容改为数字2,请勿换行或多空格,只有一个数字。

(5)将/data/env/zookeeper-3.4.6/目录复制到192.168.1.118的同样目录下,
修改/data/env/zookeeper-3.4.6/data/myid文件,内容改为数字3,请勿换行或多空格,只有一个数字。

(6)修改3个服务器的防火墙设置,确保2181,2888,3888端口对外开放。

(6)3个服务器都执行以下命令:
cd /data/env/zookeeper-3.4.6/bin
./zkServer.sh start

(7)3个服务器都启动后,都执行以下命令
./zkServer.sh status

会显示类似如下的信息:
------
JMX enabled by default
Using config: /data/env/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: follower
------
确认两台服务器的Mode是follower,一台服务器的Mode是leader

(8)通知开发人员,进行验证,验证OK即安装完毕。
-------------------------------------
简单的验证方式:
./zkCli.sh -server 192.168.1.115:2181
ls /
create /test 123
get /test
delete /test
quit
 

评论 COMMENTS
没有评论 No Comments.

添加评论 Add new comment.
昵称 Name:
评论内容 Comment:
验证码(不区分大小写)
Validation Code:
(not case sensitive)
看不清?点这里换一张!(Change it here!)
 
评论由管理员查看后才能显示。the comment will be showed after it is checked by admin.
CopyRight © 心缘地方 2005-2999. All Rights Reserved