LVS-DR负载均衡模式

 一、准备环境

  DR 模式的集群中,LVS 负载调度器作为群集的访问入口,但不作为网关使用,服务池中所有节点都各自接入Internet, 发送给客户机的web响应数据包不需要经过lvs负载调度器。  

 

 

 

二、配置负载调度器

  1)配置虚拟IP地址

   Eth0:192.168.10.254

  Eth0:0 192.168.10.100

cd /etc/sysconfig/network-scripts/

 cp  ifcfg-eth0  ifcfg-eth0:0

vi ifcfg-eth0:0

BOOTPROTO=static

DEVICE="eth0:0"

ONBOOT="yes"

IPADDR=192.168.10.183

NETMASK=255.255.255.0

 

(2)调整/proc响应参数

 

net.ipv4.conf.all.send_redirects=0

net.ipv4.conf.default.send_redirects=0

net.ipv4.conf.eth0.send_redirects=0

net.ipv4.conf.eth1.send_redirects=0

 

sysctl –p

 

(3)配置负载分配策略

  Service ipvsadm stop

  Ipvsadm –A –t 192.168.10.183:80 –s rr

Ipvsadm –a –t 192.168.10.183:80 –r 192.168.10.22 –g –w 1

Ipvsadm –a –t 192.168.10.183:80 –r 192.168.10.28 –g –w 1

Service ipvsadm save

Chkconfig ipvsadm on

 

 

二、配置节点服务器

 Cd /etc/sysconfig/network-scripts

Cp ifcfg-lo ifcfg-lo:0

 Vi ifcfg-lo:0

DEVICE=lo:0

IPADDR=192.168.10.183

NETMASK=255.255.255.255

ONBOOT=yes

Vi /etc/rc.local

sbin/route add -host 172.16.11.183 dev lo:0

 

~ [root@host1 ~]# route add -host 192.168.10.183 dev lo:0

(2)调整/proc响应参数

 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

sysctl –p

service httpd restart

 

你可能感兴趣的:(lvs负载均衡)