zookeeper-3.5.5安装部署

  • 下载zookeeper
wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/stable/apache-zookeeper-3.5.5-bin.tar.gz
  • 安装
tar -zxvf apache-zookeeper-3.5.5-bin.tar.gz -C /root/apps
mv apache-zookeeper-3.5.5-bin zookeeper-3.5.5
mkdir -p /root/apps/zookeeper-3.5.5/zkdata
mkdir -p /root/apps/zookeeper-3.5.5/logs
  • 修改zoo.cfg
cd  /root/apps/zookeeper-3.5.5/conf
cp ./zoo_sample.cfg ./zoo.cfg
vim zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/root/apps/zookeeper-3.5.5/zkdata
dataLogDir=/root/apps/zookeeper-3.5.5/logs
clientPort=2181
server.1=mini1:2888:3888
server.2=mini2:2888:3888
server.3=mini3:2888:3888
  • 创建myid
cd  /root/apps/zookeeper-3.5.5/zkdata
echo 1 > myid
  • 拷贝到其他节点修改myid为 2 ,3
scp -r /root/apps/zookeeper-3.5.5 mini2:`pwd`
scp -r /root/apps/zookeeper-3.5.5 mini3:`pwd`
  • 群起脚本
#!/bin/bash
for i in mini1 mini2 mini3
do
ssh $i "source /etc/profile;/root/apps/zookeeper-3.5.5/bin/zkServer.sh $1"
done
  • 启动zookeeper
[root@mini1 ~]# zkstart.sh start
start zkServer...
ZooKeeper JMX enabled by default
Using config: /root/apps/zookeeper-3.5.5/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
ZooKeeper JMX enabled by default
Using config: /root/apps/zookeeper-3.5.5/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
ZooKeeper JMX enabled by default
Using config: /root/apps/zookeeper-3.5.5/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

  • 查看状态
[root@mini1 ~]# zkstart.sh status
start zkServer...
ZooKeeper JMX enabled by default
Using config: /root/apps/zookeeper-3.5.5/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: follower
ZooKeeper JMX enabled by default
Using config: /root/apps/zookeeper-3.5.5/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: leader
ZooKeeper JMX enabled by default
Using config: /root/apps/zookeeper-3.5.5/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: follower

上一篇:centenos7 中 java JDK安装


下一篇:好站、好書、好詞推薦 不定時更新