Docker 搭建 Keepalived 实现 Nginx 双机热备
docker 搭建 keepalived 实现 nginx 双机热备
❯ docker run --privileged -d --name node1 debian:11 top -b
❯ docker run --privileged -d --name node2 debian:11 top -b
–-privileged
是指以特权模式启动容器,否则 keepalived 无法成功生成虚拟 IP
分别进入 node1、node2 容器节点(docker exec -it node1 /bin/bash
和 docker exec -it node2 /bin/bash
)
安装以下软件 apt update && apt install curl vim iproute2 inetutils-ping psmisc net-tools systemctl nginx keepalived -y