Zookeeper集群环境部署

编程

#获取软件包

wget https://us.mirrors.quenda.co/apache/zookeeper/zookeeper-3.6.1/apache-zookeeper-3.6.1-bin.tar.gz

#解压软件到指定目录 /usr/localhost/zookeeper

mkdir /usr/local/zookeeper

tar -zxvf apache-zookeeper-3.6.1-bin.tar.gz -C /usr/local/zookeeper

#进入 zk 目录

cd /usr/local/zookeeper/apache-zookeeper-3.6.1-bin/conf

#初始化配置文件

cp zoo_sample.cfg zoo.cfg

vim zoo.cfg

#添加以下配置--zk数据存储,日志目录

dataDir=/usr/local/zookeeper/apache-zookeeper-3.6.1-bin/data

dataDir=/usr/local/zookeeper/apache-zookeeper-3.6.1-bin/logs

#创建配置目录

mkdir /usr/local/zookeeper/apache-zookeeper-3.6.1-bin/data

mkdir /usr/local/zookeeper/apache-zookeeper-3.6.1-bin/logs

2. 集群配置

#集群配置

vi /usr/local/zookeeper/apache-zookeeper-3.6.1-bin/conf/zoo.cfg

#添加集群服务器信息

server.0=192.168.202.135:2888:3888

server.1=192.168.202.136:2888:3888

server.2=192.168.202.134:2888:3888

#设置 myid 与 service.x 对应

cd /usr/local/zookeeper/apache-zookeeper-3.6.1-bin/data

touch myid

#内容

0

将 zk 复制到 其他 机器,按照集群信息配置  myid 值

192.168.202.134 为 2   192.168.202.136 为 1

依次zk 启动即可

以上是 Zookeeper集群环境部署 的全部内容, 来源链接: utcz.com/z/518962.html

回到顶部