华为云服务器centos7.2下zookeeper机群简单搭建

1.#更改配置文件
[root@zookeeper01 conf]# cp zoo_sample.cfg zoo.cfg
[root@zookeeper01 conf]# vim  zoo.cfg
#更改持久化存储目录
dataDir=/usr/local/src/app/zookeeper-3.4.10/tmp
#增加机群设置
server.1=192.168.1.148:2888:3888
server.2=192.168.1.86:2888:3888
server.3=192.168.1.138:2888:3888

2.#创建持久化存储目录
[root@zookeeper01 zookeeper-3.4.10]# mkdir tmp
[root@zookeeper01 zookeeper-3.4.10]# cd tmp/
[root@zookeeper01 tmp]# pwd
/usr/local/src/app/zookeeper-3.4.10/tmp
[root@zookeeper01 tmp]# ls
#设置id
[root@zookeeper01 tmp]# vim myid
1 或者 2 或者 3
相应与zookeeper01 zookeeper02  zookeeper03

3.#启动zookeeper
[root@zookeeper01 conf]# cd ../bin/
[root@zookeeper01 bin]# ls
README.txt  zkCleanup.sh  zkCli.sh  zkEnv.sh  zkServer.sh  zookeeper.out
[root@zookeeper01 bin]# sh zkServer.sh start
[root@zookeeper01 bin]# jps
8640 Jps
8008 QuorumPeerMain
[root@zookeeper01 bin]# sh zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/src/app/zookeeper-3.4.10/bin/../conf/zoo.cfg
Mode: follower
[root@zookeeper01 bin]# 


你可能感兴趣的:(华为云服务器centos7.2下zookeeper机群简单搭建)