keepalived+haproxy+apache(高可用负载均衡web)
环境
四台:CentOS Linux release 7.5.1804 (Core)
- 192.168.153.179 keepalived haproxy (master)
192.168.153.178 keepalived haproxy (backup)
192.168.153.177 httpd (web1)
192.168.153.176 httpd (web2)
防火墙和selinux关闭
开始操作
- 安装
根据环境内容安装即可
yum -y install keepalived haproxy
yum -y install httpd
MASTER BACKUP端操作:keepalived
如果不清楚更改项,参考点击
vim /etc/keepalived/keepalived.conf
MASTER BACKUP端操作:haproxy
双方操作完全一样
vim /etc/haproxy/haproxy.cfg
systemctl start haproxy
web(1、2)操作:httpd
web2服务器将页面更改为 web即可
echo web1 > /var/www/html/index.html
systemctl start httpd