码迷,mamicode.com
首页 > 其他好文 > 详细

LVS负载均衡集群之DR模式

时间:2015-03-13 14:40:42      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:负载均衡   lvs   集群   

LVS负载均衡集群之DR模式


一、环境

4台虚拟机:1台Client、1台DirectorServer、2台RealServer。IP地址分别如下:

Client:192.168.12.22

DS:VIP:192.168.12.100,DIP:192.168.12.10

RealServer1:192.168.12.80

RealServer2:192.168.12.81


二、安装配置RealServer

RealServer1:

yum -y install httpd

chkconfig httpd on

echo "RealServer1" >> /var/www/html/index.html

service httpd start

/sbin/ifconfig lo:0 $VIP broadcast $VIP netmask 255.255.255.255 up

/sbin/route add -host $VIP dev lo:0

echo "1" >/proc/sys/net/ipv4/conf/lo/arp_ignore

echo "2" >/proc/sys/net/ipv4/conf/lo/arp_announce

echo "1" >/proc/sys/net/ipv4/conf/all/arp_ignore

echo "2" >/proc/sys/net/ipv4/conf/all/arp_announce

sysctl -p



RealServer2:

yum -y install httpd

chkconfig httpd on

echo "RealServer2" >> /var/www/html/index.html

service httpd start

/sbin/ifconfig lo:0 $VIP broadcast $VIP netmask 255.255.255.255 up

/sbin/route add -host $VIP dev lo:0

echo "1" >/proc/sys/net/ipv4/conf/lo/arp_ignore

echo "2" >/proc/sys/net/ipv4/conf/lo/arp_announce

echo "1" >/proc/sys/net/ipv4/conf/all/arp_ignore

echo "2" >/proc/sys/net/ipv4/conf/all/arp_announce

sysctl -p


三、安装配置DirectorServer

/sbin/ifconfig eth0:1 $VIP broadcast $VIP netmask 255.255.255.255 up

/sbin/route add -host $VIP dev eth0:1

yum -y install ipvsadm

ipvsadm -A -t 192.168.12.100:80 -s wlc

ipvsadm -a -t 192.168.12.100:80 -r 192.168.12.80 -g -w 1

ipvsadm -a -t 192.168.12.100:80 -r 192.168.12.81 -g -w 1

service ipvsadm save

ipvsadm -L -n


参数说明:

-A 添加集群服务;

-t TCP协议;

-s 指定调度算法;

-g 指定为DR模式;

-w 权重;


四、Client访问测试


ab -c 10 -n 1000 http://192.168.12.100/index.html


本文出自 “方寸小山” 博客,请务必保留此出处http://63638790.blog.51cto.com/513514/1620001

LVS负载均衡集群之DR模式

标签:负载均衡   lvs   集群   

原文地址:http://63638790.blog.51cto.com/513514/1620001

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!