一、安装keepalived
sudo apt update
sudo apt install keepalived
sudo systemctl start keepalived
sudo systemctl enable keepalived
sudo systemctl status keepalived#配置Keepalived
sudo cp /etc/keepalived/keepalived.conf.sample /etc/keepalived/keepalived.conf
nano /etc/keepalived/keepalived.conf
==================================================
global_defs {router_id LVS_DEVEL
}vrrp_instance VI_1 {state MASTERinterface enp0s3virtual_router_id 51priority 100advert_int 1authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {192.168.31.183}
}
==================================================
#重启
sudo service keepalived start
通过keepalived提拱的虚拟Ip访问haproxy代理的网站
http://192.168.31.183:5001/swagger/index.html