标签:haproxy httpd 负载 LB 100.134 192.168 root
haproxy配置httpd负载均衡
haproxy配置方法见haproxy配置及使用
环境
系统/主机名 | ip |
redhat 8 /LB | 192.168.100.134 |
redhat 8 /RS1 | 192.168.100.132 |
redhat 8 /RS2 | 192.168.100.133 |
配置
//在两台RS上安装httpd # yum -y install httpd //关闭防火墙和selinux # systemctl stop firewalld # setenforce 0 //修改第二台RS的监听端口 [root@RS2 ~]# vim /etc/httpd/conf/httpd.conf ... Listen 8080 //RS启动并设置开机自启httpd # systemctl enable --now httpd //创建测试页面 [root@RS1 ~]# echo "RS1" > /var/www/html/index.html [root@RS2 ~]# echo "RS2" > /var/www/html/index.html //关闭LB的防火墙和selinux # systemctl stop firewalld # setenforce 0 //修改LB的 haproxy配置文件 ---添加这两个主机IP和端口号 # vim /etc/haproxy/haproxy.cfg ... server web01 192.168.100.132:80 check inter 2000 fall 5 server web02 192.168.100.133:8080 check inter 2000 fall 5 //重启haproxy # pkill haproxy # systemctl start haproxy //访问测试 [root@LB ~]# curl 192.168.100.134 RS1 [root@LB ~]# curl 192.168.100.134 RS1 [root@LB ~]# curl 192.168.100.134 RS2 [root@LB ~]# curl 192.168.100.134 RS2 [root@LB ~]# curl 192.168.100.134 RS1 [root@LB ~]# curl 192.168.100.134 RS2 [root@LB ~]# curl 192.168.100.134 RS1 [root@LB ~]# curl 192.168.100.134 RS2
登录网页haproxy查看负载(登陆方式见haproxy配置及使用)
标签:haproxy,httpd,负载,LB,100.134,192.168,root 来源: https://www.cnblogs.com/lichouluoyu/p/14747820.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。