标签:lead 直接 start org 集群部署 mod default lse 拷贝
1.集群节点信息
192.168.1.118
192.168.1.135
192.168.1.136
2. 搭建一个zookeeper集群
在这三个节点搭建一个zookeeper集群(如果搭建可以直接忽略这一步),先在一个节点上根据以下配置
2.1. 下载 apache-zookeeper-3.6.3.tar.gz 安装包,放置到上面三台服务器一个目录下(/opt/)
注意这里下载的是带bin的安装包
下载地址:http://archive.apache.org/dist/zookeeper/
2.2. 进入到/opt/目录下,解压tar包,tar -zxvf apache-zookeeper-3.6.3.tar.gz
[root@localhost soft]# cd /soft
[root@localhost soft]# [root@localhost soft]# tar -xvf apache-zookeeper-3.6.3-bin.tar.gz
[root@localhost soft]# mv apache-zookeeper-3.6.3-bin /opt/
2.3. 进入zookeeper的conf目录,拷贝zoo_sample.cfg为zoo.cfg,cp zoo_sample.cfg zoo.cfg 修改zoo.cfg文件:
[root@localhost soft]# cd /opt/apache-zookeeper-3.6.3-bin/
[root@localhost apache-zookeeper-3.6.3-bin]# cd conf
[root@localhost conf]# cp zoo_sample.cfg zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir= /opt/apache-zookeeper-3.6.3-bin/data
clientPort=2182
autopurge.purgeInterval=0
globalOutstandingLimit=200
server.1=192.168.1.118:2888:3888
server.2=192.168.1.135:2888:3888
server.3=192.168.1.136:2888:3888
以上目录需要提前创建好
[root@localhost apache-zookeeper-3.6.3]# mkdir -p /opt/apache-zookeeper-3.6.3-bin/data
2.5. 设置myid
[root@localhost data]#vi /opt/apache-zookeeper-3.6.3/data/myid #192.168.1.118为1,192.168.1.135为2,192.168.1.136为3
2.6 其他节点安装,将已经部署好的节点安装目录拷贝到另外2个节点
[root@localhost opt]# tar -cvf apache-zookeeper-3.6.3-bin.tar ./apache-zookeeper-3.6.3-bin
拷贝到另外的节点
[root@localhost opt]# scp apache-zookeeper-3.6.3-bin.tar root@192.168.1.135:/opt/
[root@localhost opt]# scp apache-zookeeper-3.6.3-bin.tar root@192.168.1.136:/opt/
然后进行解压
[root@localhost opt]# cd /opt
[root@localhost opt]# tar -xvf apache-zookeeper-3.6.3-bin.tar
注意拷贝过去要修改对应的myid文件的值
2.6. 进入zookeeper的bin目录,启动zookeeper服务,每个节点都需要启动
[root@localhost bin]# cd /opt/apache-zookeeper-3.6.3-bin/bin
[root@localhost bin]# ./zkServer.sh start
2.7. 启动之后查看每个节点的状态
[root@localhost bin]# ./zkServer.sh status
/bin/java
ZooKeeper JMX enabled by default
Using config: /opt/apache-zookeeper-3.6.3-bin/bin/../conf/zoo.cfg
Client port found: 2182. Client address: localhost. Client SSL: false.
Mode: follower
其中有一个节点是leader,有两个节点是follower,证明zookeeper集群是部署成功的
2.8. 测试zookeeper
[root@localhost bin]# ./zkCli.sh -server 192.168.1.136:2182
标签:lead 直接 start org 集群部署 mod default lse 拷贝
原文地址:https://www.cnblogs.com/hxlasky/p/14665752.html