标签:eth out tar apach ipvsadm lag 相同 water top
一、配置的网络拓扑结构图
二、配置lvs服务器
[root@localhost ~]# ifconfig eno16777728:0 192.168.200.253 netmask 255.255.255.0 #查看配置结果 [root@localhost ~]# ifconfig eno16777728:0 eno16777728:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.200.253 netmask 255.255.255.0 broadcast 192.168.200.255 ether 00:0c:29:f0:42:97 txqueuelen 1000 (Ethernet)
[root@localhost ~]# yum -y install ipvsadm #查看安装结果 [root@localhost ~]# rpm -qa ipvsadm ipvsadm-1.27-7.el7.x86_64
[root@localhost ~]# ipvsadm -A -t 192.168.200.253:80 -s rr [root@localhost ~]# ipvsadm -a -t 192.168.200.254:80 -r 192.168.200.112:80 -g -w 1 [root@localhost ~]# ipvsadm -a -t 192.168.200.253:80 -r 192.168.200.113:80 -g -w 1
三、配置Apache节点服务器(两台服务器配置相同)
[root@localhost ~]# ifconfig lo:0 192.168.200.253 netmask 255.255.255.255
[root@localhost ~]# route add -host 192.168.200.253 dev lo:0 #将访问VIP的数据限制在本地以避免通信紊乱。
[root@localhost ~]# vim /etc/sysctl.conf net.ipv4.conf.all.arp_ignore=1 net.ipv4.conf.all.arp_announce = 2 net.ipv4.conf.default.arp_ignore = 1 net.ipv4.conf.default.arp_announce = 2 net.ipv4.conf.lo.arp_ignore = 1 net.ipv4.conf.lo.arp_announce = 2 #启用参数 [root@localhost ~]# sysctl -p net.ipv4.conf.all.arp_ignore = 1 net.ipv4.conf.all.arp_announce = 2 net.ipv4.conf.default.arp_ignore = 1 net.ipv4.conf.default.arp_announce = 2 net.ipv4.conf.lo.arp_ignore = 1 net.ipv4.conf.lo.arp_announce = 2
[root@localhost ~]# yum -y install httpd
#开启httpd服务
[root@localhost ~]# systemctl start httpd
四、测试
[root@localhost ~]# systemctl stop firewalld [root@localhost ~]# setenforce 0 [root@localhost ~]# iptables -F
[root@localhost ~]# echo "111111111" > /var/www/html/index.html
标签:eth out tar apach ipvsadm lag 相同 water top
原文地址:https://www.cnblogs.com/canflyfish/p/11635039.html