centos7 安裝zookeeper3.4.8集群
阿新 • • 發佈:2017-06-01
snap where div roo vim conf urn 目錄 syn
1.下載上傳文件到centos中
2.解壓文件夾
3.cd conf 文件下,cp zoo_sample.cfg zoo.cfg
4.vim 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 # 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.121.131:2888:3888 server.2=192.168.121.129:2888:3888
設置文件如上所示:
ip地址也可以用主機名代替
5.創建myid文件,在/opt/zookeeper 文件夾下 創建myid 運行命令 touch myid , 然後寫入數字 echo 1 >myid
6.在192.168.121.129 中也如192.168.121.131相關的操作
7.關掉防火墻,或者打開相應的端口
8.cd 到 bin 目錄下
9.啟動server.1 然後啟動 server.2 ,./zkServer.sh start
10.過一段時間運行./zkServer.sh status 查看狀態如果顯示下面的信息則表示成功
[[email protected] bin]# ./zkServer.sh status ZooKeeper JMX enabled by default Using config: /home/fuyuanming/zookeeper-3.4.8/bin/../conf/zoo.cfg Mode: leader
或者:
[[email protected] bin]# ./zkServer.sh status ZooKeeper JMX enabled by default Using config: /home/fuyuanming/zookeeper-3.4.8/bin/../conf/zoo.cfg Mode: follower
表示成功
centos7 安裝zookeeper3.4.8集群