server1:
yum install httpd -y
cd /var/www/html
vim index.html
systemctl start httpd
vim /etc/httpd/conf/httpd.conf
systemctl start httpd
将端口改成8000

cd /etc/haproxy/
vim haproxy.cfg
systemctl restart haproxy.service


server3:

测试:
当动态访问时,实现轮询


当访问为静态时
server1 拿到 server3的资源


此时
vim haproxy.cfg
systemctl restart haproxy

只要server2不down掉,server1永远是备机

本文详细介绍如何在server1上安装并配置Apache,修改默认端口为8000,以及如何在server3上进行测试,实现动态访问时的轮询负载均衡。同时,深入探讨了如何通过编辑haproxy.cfg文件使server1能够获取server3的资源,保持server2正常运行情况下,server1作为备机的角色。
1024

被折叠的 条评论
为什么被折叠?



