1.基础架构
主机名 | 角色 | ip |
HDSS7-11.host.com | K8S代理节点1,zk1 | 10.4.7.11 |
HDSS7-12.host.com | K8S代理节点2,zk2 | 10.4.7.12 |
HDSS7-21.host.com | K8S运算节点1,zk3 | 10.4.7.21 |
HDSS7-22.host.com | K8S运算节点2,jenkins | 10.4.7.22 |
HDSS7-200.host.com | K8S运维节点(docker仓库) | 10.4.7.200 |
Dubbo微服务概述
实验架构
2.部署zookeeper
2.1.安装JDK1.8(3台zk角色主机)
jdk下载地址:https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
[root@hdss7-11 src]# mkdir /usr/java [root@hdss7-11 src]# tar xf jdk-8u221-linux-x64.tar.gz -C /usr/java/ [root@hdss7-11 src]# cd /usr/java/ [root@hdss7-11 java]# ln -s jdk1.8.0_221/ jdk [root@hdss7-11 ~]# vim /etc/profile export JAVA_HOME=/usr/java/jdk export PATH=$JAVA_HOME/bin:$JAVA_HOME/bin:$PATH export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
[root@hdss7-11 ~]# source /etc/profile
2.2.安装zookeeper(3台zk角色主机)
zookeeper官方地址:https://zookeeper.apache.org/
zookeeper下载地址:https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.6.1/apache-zookeeper-3.6.1-bin.tar.gz
[root@hdss7-11 src]# tar xf zookeeper-3.4.14.tar.gz -C /opt [root@hdss7-11 opt]# ln -s zookeeper-3.4.14/ zookeeper
[root@hdss7-11 opt]# mkdir -pv /data/zookeeper/{data,logs}
[root@hdss7-11 ~]# vim /opt/zookeeper/conf/zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/data/zookeeper/data
dataLogDir=/data/zookeeper/logs
clientPort=2181
server.1=zk1.fx.com:2888:3888
server.2=zk2.fx.com:2888:3888
server.3=zk3.fx.com:2888:3888
2.3.为zookeeper提供myid
[root@hdss7-11 ~]# vim /data/zookeeper/data/myid 1 [root@hdss7-12 ~]# vim /data/zookeeper/data/myid 2 [root@hdss7-21 ~]# vim /data/zookeeper/data/myid 3
2.4.配置DNS解析
[root@hdss7-11 ~]# vim /var/named/fx.com.zone $ORIGIN fx.com. $TTL 600 ; 10 minutes @ IN SOA dns.fx.com. dnsadmin.fx.com. ( 2020061011 ; serial 10800 ; refresh (3 hours) 900 ; retry (15 minutes) 604800 ; expire (1 week) 86400 ; minimum (1 day) ) NS dns.fx.com. $TTL 60 ; 1 minute dns A 10.4.7.11 harbor A 10.4.7.200 k8s-yaml A 10.4.7.200 traefik A 10.4.7.10 dashboard A 10.4.7.10 zk1 A 10.4.7.11 zk2 A 10.4.7.12 zk3 A 10.4.7.21
[root@hdss7-11 ~]# systemctl restart named
2.5.启动zookeeper
[root@hdss7-11 ~]# /opt/zookeeper/bin/zkServer.sh start ZooKeeper JMX enabled by default Using config: /opt/zookeeper/bin/../conf/zoo.cfg Starting zookeeper ... STARTED
2.6.查看zookeeper信息
[root@hdss7-11 ~]# /opt/zookeeper/bin/zkServer.sh status ZooKeeper JMX enabled by default Using config: /opt/zookeeper/bin/../conf/zoo.cfg Mode: follower [root@hdss7-12 ~]# /opt/zookeeper/bin/zkServer.sh status ZooKeeper JMX enabled by default Using config: /opt/zookeeper/bin/../conf/zoo.cfg Mode: leader [root@hdss7-21 ~]# /opt/zookeeper/bin/zkServer.sh status ZooKeeper JMX enabled by default Using config: /opt/zookeeper/bin/../conf/zoo.cfg Mode: follower