Implementing virtual servers via direct routing (VS/DR)
As with the Vs/tun method, VS/DR takes advantage of the asymmetric features of most internet services, where the load scheduler is only responsible for scheduling requests, and the server directly returns the response to the customer, which can greatly improve the throughput of the entire cluster system. VS/DR Architecture: Both the Scheduler and the server group must physically have a network card connected via a disconnected LAN, such as through a high-speed switch or hub. VIP address for Dispatcher and server group sharing, dispatcher configuration VIP address is externally visible, used to receive virtual service request message; All servers configure VIP addresses on their non-arp network devices, which are not visible to the outside, but only for the purpose of handling network requests with the VIP address.
650) this.width=650; "style=" width:600px;height:571px; "src=" http://s3.51cto.com/wyfs02/M02/6E/3A/ Wkiol1v28dudkvjbaagzkyn5ztq578.jpg "title=" vs-dr.jpg "alt=" wkiol1v28dudkvjbaagzkyn5ztq578.jpg "border=" 0 "height=" 571 "hspace=" 0 "vspace=" 0 "width="/> "
Dr Basic Architecture implementation
Environment Preparation:
Equipment
|
Software Environment
|
Network environment
|
Director_server (DIRDR)
|
Centos+ipvs
|
RIP eth0_192.168.1.121
|
VIP eth0:0_192.168.1.200
|
Real_server_a (RSA)
|
Centos
|
RIP eth0_192.168.1.118
|
VIP lo:0_192.168.1.200
|
Real_server_b (RSB)
|
Centos
|
RIP eth0_192.168.1.119
|
VIP lo:0_192.168.1.200
|
Operation Scheme:
The # is configured on dir [[Email protected] ~]# vim /usr/local/sbin/lvs_dr.sh#! /bin/bashecho 1 > /proc/sys/net/ipv4/ip_forwardipv=/sbin/ipvsadmvip=192.168.1.200rs1=192.168.1.118rs2= 192.168.1.119ifconfig eth0:0 $VIP broadcast $vip netmask 255.255.255.255 uproute add -host $vip dev eth0:0$ipv -C$ipv -A -t $VIP: 80 - s rr$ipv -a -t $VIP:80 -r $rs 1:80 -g -w 1$ipv -a -t $VIP:80 -r $rs 2:80 -g -w 1[[email protected] ~]# chmod a+x /usr/local/sbin/lvs_dr.sh[[email protected] ~]# /bin/bash /usr/local/sbin/lvs_dr.sh[ [email protected] ~]# ipvsadm -lnip virtual server version 1.2.1 (size=4096) prot localaddress:port scheduler flags -> remoteaddress:port forward weight activeconn inactconntcp 192.168.1.200:80 rr -> 192.168.1.118:80 Route 1 0 0 -> 192.168.1.119:80 Route 1 0 0[[email protected] ~]# ifconfig -aeth0 Link encap:Ethernet HWaddr 00:0c:29:55:3e:24 inet addr:192.168.1.121 Bcast:192.168.1.255 Mask:255.255.255.0   INET6 ADDR: FE80::20c:29ff:fe55:3e24/64 scope:link up broadcast running multicast mtu:1500 metric:1 rx packets:700 errors:0 dropped:0 overruns:0 frame:0 tx packets:474 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 rx bytes:68287 (66.6 kib) TX bytes:76635 (74.8 kib) interrupt:18 base address:0x2000eth0:0 link encap:ethernet hwaddr 00:0c:29:55:3e:24 inet addr:192.168.1.200 bcast:192.168.1.200 mask:255.255.255.255 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Interrupt:18 Base address:0x2000lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 rx packets:0 errors:0 dropped:0 overruns:0 frame : 0 tx packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 ( 0.0 B) # configured on RSA and RSB [[email protected] ~]# vim /usr/local/sbin/lvs_dr_rs.sh#! /bin/bashvip=192.168.1.200ifconfig lo:0 $VIP broadcast $vip netmask 255.255.255.255 uproute add -host $vip lo:0echo "1" >/proc/sys/net/ipv4/ conf/lo/arp_ignoreecho "2" >/proc/sys/net/ipv4/conf/lo/arp_announceecho "1" >/proc/ sys/net/ipv4/conf/all/arp_ignoreecho "2" >/proc/sys/net/ipv4/conf/all/arp_announce[[email protected] ~]# chmod a+x /usr/local/sbin/lvs_dr_rs.sh[[email protected] ~]# /bin/bash /usr/local/sbin/lvs_dr_rs.sh[[email protected] ~]# ifconfig -aeth0 &nbSp link encap:ethernet hwaddr 00:0c:29:56:5c:c5 inet addr:192.168.1.118 bcast:192.168.1.255 mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe56:5cc5/64 scope:link up broadcast running MULTICAST MTU:1500 Metric:1 RX packets:549 errors:0 dropped:0 overruns:0 frame:0 TX packets:424 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:55100 (53.8 kib) tx bytes:61251 (59.8&NBsp KiB) interrupt:18 base address:0x2000lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host up loopback running mtu:65536 metric:1 rx packets:2 errors:0 dropped:0 overruns:0 frame:0 tx packets:2 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:160 (160.0 b) tx bytes:160 (160.0 b) lo:0 link encap:local Loopback inet addr:192.168.1.200 Mask:255.255.255.255 UP LOOPBACK Running mtu:65536 metric:1
Browser testing:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6E/3B/wKioL1V3AfexagjeAACAsWoBmRw122.jpg "title=" 200a.jpg "alt=" Wkiol1v3afexagjeaacaswobmrw122.jpg "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6E/3E/wKiom1V3AGDSom3aAACIdgLgNqE124.jpg "title=" 200b.jpg "alt=" Wkiom1v3agdsom3aaacidglgnqe124.jpg "/>
Testing effects on Linux clients
[Email protected] ~]# Curl 192.168.1.200This is test page,this was a.[[email protected] ~]# Curl 192.168.1.200This is test Page,this is b.[[email protected] ~]# Curl 192.168.1.200This are test page,this is a.[[email protected] ~]# Curl 192.168.1 .200This is test page,this is b.[[email protected] ~]# Curl 192.168.1.200This are test page,this is a.[[email protected] ~] # Curl 192.168.1.200This is Test page,this is B.
This article is from the "topspeed_king" blog, make sure to keep this source http://mylinuxlife.blog.51cto.com/4706737/1660237
LVS-DR Architecture principle and implementation scheme