安装部署zookeeper
主机名 | 角色 | IP |
---|
node7-11.host.com | zk1 | 10.4.7.11 | node7-12.host.com | zk2 | 10.4.7.12 | node7-21.host.com | zk3 | 10.4.7.21 |
node7-11添加解析
~]# vi /var/named/od.com.zone
serial 前滚一个
zk1 A 10.4.7.11
zk2 A 10.4.7.12
zk3 A 10.4.7.21
~]# systemctl restart named ~]# dig -t A zk1.od.com @10.4.7.11 +short
10.4.7.11
安装jdk
分别在 11/12/21上执行: src]# cd /opt/src/ src]# ls jdk-8u221-linux-x64.tar.gz zookeeper-3.4.14.tar.gz src]# tar xf jdk-8u221-linux-x64.tar.gz -C /usr/local src]# ln -s /usr/local/jdk1.8.0_221/ /usr/local/java src]# cat /etc/profile.d/jdk.sh
JAVA_HOME=/usr/local/java/
CLASSPATH=$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin
JRE_HOME=$JAVA_HOME/jre
export PATH JAVA_HOME CLASSPATH
src]# source /etc/profile src]# java -version
安装zookeeper
src]# tar xf zookeeper-3.4.14.tar.gz -C /opt src]# cd /opt opt]# ln -s /opt/zookeeper-3.4.14/ /opt/zookeeper opt]# mkdir -pv /data/zookeeper/data /data/zookeeper/logs opt]# vi /opt/zookeeper/conf/zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/data/zookeeper/data
dataLogDir=/data/zookeeper/logs
clientPort=2181
server.1=zk1.od.com:2888:3888
server.2=zk2.od.com:2888:3888
server.3=zk3.od.com:2888:3888
[root@node7-11 src]# cat /data/zookeeper/data/myid 1 [root@node7-12 ~]# cat /data/zookeeper/data/myid 2 [root@node7-21 ~]# cat /data/zookeeper/data/myid 3 opt]# /opt/zookeeper/bin/zkServer.sh start
检查
[root@node7-11 src]# /opt/zookeeper/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Mode: leader
[root@node7-12 ~]# /opt/zookeeper/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Mode: follower
[root@node7-21 ~]# /opt/zookeeper/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Mode: follower
|