规划
服务 | 路径 | ip:port |
---|---|---|
etcd | /data/docker/etcd | 192.123.2.1:2379、2380 |
etcd | /data/docker/etcd | 192.123.2.2:2379、2380 |
etcd | /data/docker/etcd | 192.123.2.3:2379、2380 |
keepalived | /etc/keepalived | 主机IP:192.123.2.1,浮动IP:192.123.2.100 |
keepalived | /etc/keepalived | 主机IP:192.123.2.2,浮动IP:192.123.2.100 |
keepalived | /etc/keepalived | 主机IP:192.123.2.3,浮动IP:192.123.2.100 |
apisix | /data/docker/apisix | 192.123.2.1:9080、9443、3305 |
apisix | /data/docker/apisix | 192.123.2.1:9080、9443、3305 |
apisix | /data/docker/apisix | 192.123.2.1:9080、9443、3305 |
apisix-dashboard | /data/docker/apisix-dashboard | 192.123.2.1:9000 |
部署 etcd
单机
/data/docker/etcd/docker-compose.yml
1 | version: "3.8" |
集群
192.123.2.1
1 | version: "3.8" |
192.123.2.2
1 | version: "3.8" |
192.123.2.3
1 | version: "3.8" |
部署 keepalived
安装
1 | 安装 |
keepalived.conf 配置
路径:/etc/keepalived/keepalived.conf
配置说明
- state 取值
- MASTER:master 节点
- BACKUP:backup节点
- interface:宿主机的网卡名
- mcast_src_ip:宿主机的 ip
- priority:master 节点的 priority 值需要大于 backup 节点的值
- virtual_ipaddress:浮动 IP
192.123.2.1
1 | global_defs { |
192.123.2.2
1 | global_defs { |
192.123.2.3
1 | global_defs { |
检测脚本
/etc/keepalived/alive-check.sh
1 | !/usr/bin/env bash |
配置定时任务
1 | * * * * * /etc/keepalived/alive-check.sh >> /etc/keepalived/stdout.log 2>&1 |
部署 apisix
docker-compose.yml
/data/docker/apisix/docker-compose.yml
1 | version: "3.8" |
config.yaml
/data/docker/apisix/conf/config.yaml
1 | apisix: |
部署 apisix-dashboard
docker-compose.yml
/data/docker/apisix-dashboard/docker-compose.yml
1 | version: "3.8" |
conf.yml
/data/docker/apisix-dashboard/conf/conf.yml
1 | # |