码迷,mamicode.com
首页 > 其他好文 > 详细

zookeeper集群搭建步骤

时间:2019-10-04 22:37:36      阅读:98      评论:0      收藏:0      [点我收藏+]

标签:解压   default   echo   配置   jmx   zook   命令   sam   star   

前提:准备3台linux虚机
下面是实操命令步骤
一、下载zk
[app@zknode01 ~]$ mkdir zookeeper
[app@zknode01 ~]$ cd zookeeper
[app@zknode01 zookeeper]$ mkdir zkdata
[app@zknode01 zookeeper]$ mkdir zkdatalog
[app@zknode01 zookeeper]$ wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.13/zookeeper-3.4.13.tar.gz

 二、解压zk
[app@zknode01 zookeeper]$ tar -xzvf zookeeper-3.4.13.tar.gz
[app@zknode01 zookeeper]$ cd zookeeper-3.4.13/
[app@zknode01 zookeeper-3.4.13]$ cd conf
[app@zknode01 conf]$ cp zoo_sample.cfg zoo.cfg

三、配置zoo.cfg
[app@zknode01 conf]$ vim zoo.cfg
dataDir=/home/app/zookeeper/zkdata
dataLogDir=/home/app/zookeeper/zkdatalog
server.1=10.10.30.238:12888:13888
server.2=10.10.30.239:12888:13888
server.3=10.10.30.240:12888:13888
以上ip需配置实际地址
node2和node3重复以上步骤

四、配置myid
[app@zknode01 ~]$ echo "1" > /home/app/zookeeper/zkdata/myid
[app@zknode02 ~]$ echo "2" > /home/app/zookeeper/zkdata/myid
[app@zknode03 ~]$ echo "3" > /home/app/zookeeper/zkdata/myid

五、编辑zookeeper.out输出路径
在zkEnv.sh
修改ZOO_LOG_DIR="$ZOOKEEPER_PREFIX/logs"


六、启动zk
启动node01
[app@zknode01 ~]$ /home/app/zookeeper/zookeeper-3.4.13/bin/zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /home/app/zookeeper/zookeeper-3.4.13/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[app@zknode01 ~]$

启动node02
[app@zknode02 conf]$ /home/app/zookeeper/zookeeper-3.4.13/bin/zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /home/app/zookeeper/zookeeper-3.4.13/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

启动node03
[app@zknode03 conf]$ /home/app/zookeeper/zookeeper-3.4.13/bin/zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /home/app/zookeeper/zookeeper-3.4.13/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

查看node1状态
[app@zknode01 ~]$ /home/app/zookeeper/zookeeper-3.4.13/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /home/app/zookeeper/zookeeper-3.4.13/bin/../conf/zoo.cfg
Mode: follower
[app@zknode01 ~]$

查看node2状态
[app@zknode02 conf]$ /home/app/zookeeper/zookeeper-3.4.13/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /home/app/zookeeper/zookeeper-3.4.13/bin/../conf/zoo.cfg
Mode: leader
[app@zknode02 conf]$

查看node3状态
[app@zknode03 conf]$ /home/app/zookeeper/zookeeper-3.4.13/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /home/app/zookeeper/zookeeper-3.4.13/bin/../conf/zoo.cfg
Mode: follower
[app@zknode03 conf]$

zk集群搭建完毕。

zookeeper集群搭建步骤

标签:解压   default   echo   配置   jmx   zook   命令   sam   star   

原文地址:https://www.cnblogs.com/xingxin666/p/11623435.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!