centOS系统下zookeeper集群部署

来源:互联网 发布:最大子数组 动态规划 编辑:程序博客网 时间:2024/05/28 06:07

1、Install 

将zookeeper.XXX.tar.gz 解压到指定的路径,如/usr/local/src

2、config

我们集群中提供相同应用的服务群称为quorum,其中的每台机器都有相同的配置文件

2.1)mkdir -p /var/zookeeper/data (可以指定系统中分配较大的空间分区)

2.2)编辑config文件(安装根目录下的conf目录下)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.
dataDir=/tmp/zookeeper
maxClientCnxns=100
# the port at which the clients will connect
clientPort=2181
server.1=服务ip:2555:3555
server.2=服务ip:2555:3555
server.3=服务ip:2555:3555

其中server.x代表整个集群的机器,当服务启动时,会在数据目录(上面的data目录)下

查找命名位myid的文件。

2.3)配置myid文件

在数据目录下创建名为myid(不要带任何扩展属性)的文件,根据server.x在对应的

ip机器上的myid文件中填入对应的编号(譬如,server123.1,则在ip为server123的

机器上的myid文件中填上1)

3、注意配置centOS上的防火墙端口

查看防火墙状态  service iptables status

关闭防火墙 service iptables  stop

或者通过配置文件方式添加对应的端口(鉴于篇幅不赘述)

4、启动集群中的机器

三台主机执行 zkServer.sh   start启动,注意三台启动的间隔时间

不要太长(因为有超时设定)

0 0
原创粉丝点击