如何利用lvs-DR搭建负载均衡群集
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何利用lvs-DR搭建负载均衡群集相关的知识,希望对你有一定的参考价值。
一、top图:
director:192.168.146.20
vip:192.168.146.19
realserver1:192.168.146.21
vip:192.168.146.19
realserver2:192.168.146.22
vip:192.168.146.19
二、director配置:
讲eth0复制出来一份,命名为eth0:1,ip地址配置为vip的地址。
#mount /dev/cdrom /mnt
#rpm -ivh /mnt/Packages/ipvsadm-1.26-2.el6.x86_64.rpm
# ipvsadm -A -t 192.168.146.19:80 -s rr
# ipvsadm -a -t 192.168.146.19:80 -r 192.168.146.21:80 -g
#ipvsadm -a -t 192.168.146.19:80 -r 192.168.146.22:80 -g
# ipvsadm -L -n
三、rs1:
#vim /etc/sysctl.conf
net.ipv4.conf.eth0.arp_ignore = 1 #追加这两行
net.ipv4.conf.eth0.arp_announce = 2
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2
# yum install -y httpd
# echo “this is rs1” > /var/www/html/index.html
# service httpd restart
四、rs2:
#vim /etc/sysctl.conf
net.ipv4.conf.eth0.arp_ignore = 1 #追加这两行
net.ipv4.conf.eth0.arp_announce = 2
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2
# yum install -y httpd
# echo “this is rs1” > /var/www/html/index.html
# service httpd restart
五、测试:
弄台随意的linux机器:
Linux
本文出自 “HUAZAi-CTO” 博客,谢绝转载!
以上是关于如何利用lvs-DR搭建负载均衡群集的主要内容,如果未能解决你的问题,请参考以下文章