Zookeeper最簡單的叢集部署
Zookeeper安裝
1.環境 : 3臺linux系統 zookeeper1 zookeeper2 zookeeper3
軟體:http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.14/
2.配置yum 三臺都配置 使用網路yum或者本地yum
3.修改hosts檔案 三臺都配置
cat >>/etc/hosts<<EOF
192.168.200.128 zookeeper1
192.168.200.129 zookeeper2
192.168.200.130 zookeeper3
EOF
4.安裝java版本 三臺都得安裝
yum install -y java-1.8.0-openjdk*
5.上傳軟體包到/usr/local 三臺都上傳 可以使用scp進行傳送檔案 解壓軟體:
tar -xf zookeeper-3.4.14.tar.gz
6.修改conf的配置檔案:
/usr/local/zookeeper-3.4.14/conf 下的:
cd /usr/local/zookeeper-3.4.14/conf
cp -a zoo_sample.cfg zoo.cfg
6.追加引數:
cat >>zoo.cfg<<EOF
server.1=192.168.229.128:2888:3888
server.2=192.168.229.129:2888:3888
server.3=192.168.229.130:2888:3888
注意事項:IP地址根據需要進行修改
7.建立檔案 三臺都建立
zookeeper1:
mkdir -p /tmp/zookeeper/
echo “1” >>/tmp/zookeeper/myid
chmod 777 -R /tmp
zookeeper2:
mkdir -p /tmp/zookeeper/
echo “2” >>/tmp/zookeeper/myid
zookeeper3:
mkdir -p /tmp/zookeeper/
echo “3” >>/tmp/zookeeper/myid
8.配置免金鑰: 三臺都執行
ssh-keygen -t rsa
ssh-copy-id zookeeper1
ssh-copy-id zookeeper3
9.最後每臺都啟動服務
bash /usr/local/zookeeper-3.4.14/bin/zkServer.sh start
10.最後進行驗證:
[[email protected] ~]# bash /usr/local/zookeeper-3.4.14/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.14/bin/…/conf/zoo.cfg
Mode: leader
[[email protected] ~]#
最終效果: