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
EOF
注意事项: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 zookeeper2
ssh-copy-id zookeeper3
9.最后每台都启动服务
bash /usr/local/zookeeper-3.4.14/bin/zkServer.sh start
10.最后进行验证:
[root@zookeeper2 ~]# 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
[root@zookeeper2 ~]#
最终效果: