【Zookeeper】zookeeper集群安装

单节点安装参考:http://blog.sina.com.cn/s/blog_6f6bc30e0101pb13.html
zookeeper集群安装

  1. 注意事项:
  2. 1.注意 /etc/hosts需要配置
  3. 2.注意打开每台节点之间的iptables通讯


3台主机配置文件如下

  1. [root@DB-23 zookeeper]# more conf/zoo.cfg | grep -v "#"
  2. tickTime=2000
  3. initLimit=10
  4. syncLimit=5
  5. dataDir=/data/app/zookeeper/data
  6. clientPort=2181
  7. autopurge.purgeInterval=1

  8. server.1=10.32.7.113:2889:3888
  9. server.2=10.32.7.112:2889:3888
  10. server.3=10.32.7.111:2889:3888

修改每台机器的myid

  1. myid需要与配置文件中的server后面的数字对应
  2. [root@DB-23 data]# pwd
    /data/app/zookeeper/data
    [root@DB-23 data]# more myid 
    1
  3. [root@DB-22 data]# pwd
    /data/app/zookeeper/data
    [root@DB-22 data]# more myid 
    2

  4. [root@DB-21 data]# pwd
    /data/app/zookeeper/data
    [root@DB-21 data]# more myid 
    3


启动每台机器的zookeeper并校验

  1. [root@DB-21 conf]# zk-server status
  2. JMX enabled by default
  3. Using config: /data/app/zookeeper/bin/../conf/zoo.cfg
  4. Mode: follower

  5. [root@DB-22 conf]# zk-server status
  6. JMX enabled by default
  7. Using config: /data/app/zookeeper/bin/../conf/zoo.cfg
  8. Mode: leader   --选出来的leader

  9. [root@DB-23 data]# zk-server status
  10. JMX enabled by default
  11. Using config: /data/app/zookeeper/bin/../conf/zoo.cfg
  12. Mode: follower


文章名称:【Zookeeper】zookeeper集群安装
标题网址:http://scyanting.com/article/ihcjdj.html