分享

[qiujie]zookeeper 配置分布式,但是启动时standalone

Alan-pan 发表于 2016-12-9 20:55:28 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 6 23109

[root@master zookeeper]# jps
5394 QuorumPeerMain
5876 Jps
[root@master zookeeper]# clear
[root@master zookeeper]# bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Mode: standalone
----------------------------------------------------------------------------------------
[root@node1 zookeeper]# bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: //opt/zookeeper/bin/../conf/zoo.cfg
Mode: standalone
[root@node1 zookeeper]#


-------------------------------------------------------------------------------------------------
[root@node2 zookeeper]# bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: //opt/zookeeper/bin/../conf/zoo.cfg
Mode: standalone
[root@node2 zookeeper]# cat conf/zoo.cfg
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=5
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=2
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/opt/zookeeper/data/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/ ... 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=master:2888:3888
 server.2=node1:2889:3889
 server.3=node2:2880:3880


已有(6)人评论

跳转到指定楼层
langke93 发表于 2016-12-10 16:16:08
Alan-pan 发表于 2016-12-10 15:23
端口最初就是这个设置的,还是standalone, 防火墙关闭。 麻烦大神给支个招, 小弟在此跪谢!!!!!

...

单机与集群唯一的不同就是
单机是一个
   server.1=master:2888:3888


集群是三个  
    server.1=master:2888:3888
 server.2=node1:2889:3889
 server.3=node2:2880:3880

楼主显然是三个。

这个是没有错的。
是否在对应的目录路创建 id

备注:
id被称为 Server ID,用来标识该机器在集群中的机器序列号。同时,在每台Zookeeper机器上,我们都需要在数据目录(即dataDir参数指定的那个目录)下创建一个myid文件,该文件只有一行内容,并且是一个数字,即对应于每台机器的Server ID 数字。

回复

使用道具 举报

nextuser 发表于 2016-12-9 22:08:28

楼主改下端口



更多可参考这个
Zookeeper集群环境安装过程详解
http://www.aboutyun.com/forum.php?mod=viewthread&tid=8086


回复

使用道具 举报

Alan-pan 发表于 2016-12-10 15:23:28

端口最初就是这个设置的,还是standalone, 防火墙关闭。 麻烦大神给支个招, 小弟在此跪谢!!!!!

initLimit=10syncLimit=5

clientPort=2181
dataDir=/opt/zookeeper/data/zookeeper
 server.1=master:2888:3888
 server.2=node1:2888:3888
 server.3=node2:2888:3888



回复

使用道具 举报

w517424787 发表于 2016-12-10 16:17:47
你有没有在data目录下创建myid文件,并设定值,值跟server.1,后面的数字相同!
回复

使用道具 举报

w517424787 发表于 2016-12-10 16:19:27
本帖最后由 w517424787 于 2016-12-10 16:21 编辑

e. 创建并打开myid文件
- cd $ZOOKEEPER_HOME/data
- touch myid
- vi myid
f. 配置myid
按照zoo.cfg的配置,myid的内容就是1。//这个1要和server.1相同

在相应的zookeeper节点上都要创建myid文件,内容要和zoo.cfg中配置的server数字相同
回复

使用道具 举报

Alan-pan 发表于 2016-12-10 16:32:50
非常感谢各位, 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=/opt/zookeeper/data/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/ ... 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 = master:2888:3888
# server.2=node1:2888:3888
# server.3=node2:2888:3888

tickTime=2000
dataDir=/opt/zookeeper/data/zookeeper
clientPort=2181
initLimit=10
syncLimit=5
server.1=master:2888:3888
server.2=node1:2888:3888
server.3=node2:2888:3888






回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条