LVS Direct Return 관련
글쓴이: litmisty / 작성시간: 화, 2009/12/15 - 6:07오후
LVS (ipvsadm + keepalive)로 Direct Return 을 구현했습니다.
실 서버가 없어서 버추어박스를 여러대 띄워놓고 구성했는데요
로드발란서 2대, 리얼서버 2대로 구성했습니다.
192.168.1.99 (VIP)
192.168.1.140 (LB MASTER)
192.168.1.145 (LB BACKUP)
192.168.1.143 (Real server1)
192.168.1.144 (Real server2)
192.168.1.140(LB MASTER)# ip addr 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 08:00:27:f1:21:46 brd ff:ff:ff:ff:ff:ff inet 192.168.1.140/24 brd 192.168.1.255 scope global eth0 inet 192.168.1.99/24 scope global secondary eth0 inet6 fe80::a00:27ff:fef1:2146/64 scope link valid_lft forever preferred_lft forever 192.168.1.140(LB MASTER)# ipvsadm Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn TCP 192.168.1.99:http wlc -> 192.168.1.144:http Route 1 0 0 -> 192.168.1.143:http Route 1 0 0
192.168.1.143(Real server1)# ifconfig eth0 Link encap:Ethernet HWaddr 08:00:27:9F:B9:35 inet addr:192.168.1.143 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe9f:b935/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:258510 errors:642 dropped:0 overruns:0 frame:0 TX packets:42668 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:28102679 (26.8 MiB) TX bytes:4732192 (4.5 MiB) Interrupt:11 Base address:0xd020 lo 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:16436 Metric:1 RX packets:466 errors:0 dropped:0 overruns:0 frame:0 TX packets:466 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:53955 (52.6 KiB) TX bytes:53955 (52.6 KiB) lo:0 Link encap:Local Loopback inet addr:192.168.1.99 Mask:255.255.255.255 UP LOOPBACK RUNNING MTU:16436 Metric:1 192.168.1.143(Real server1)# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.99 0.0.0.0 255.255.255.255 UH 0 0 0 lo 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
이렇게 설정하였습니다.
제가 이해하기로는 DR구성은 사용자의 리퀘스트는 VIP로 받아 로드발란서에서 리얼 서버로 패킷을 내려보내고, 리얼 서버는 리퀘스트를 처리해서 loop back으로 사용자에게 응답을 보내는 걸로 이해했는데요.
이해가 안되는 부분이 있어서 질문 드립니다.
페이지는 정상적으로 두 서버에서 나눠져서 응답이 오는데요, 전송량을 체크 해 보았을 때
192.168.1.140(LB MASTER)# cat /proc/net/dev Inter-| Receive | Transmit face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed lo: 18511 190 0 0 0 0 0 0 18511 190 0 0 0 0 0 0 eth0:22256168 157429 399 0 0 0 0 0 11055398 147521 0 0 0 0 0 0 sit0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 192.168.1.143(Real server1)# cat /proc/net/dev Inter-| Receive | Transmit face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed lo: 53955 466 0 0 0 0 0 0 53955 466 0 0 0 0 0 0 eth0:28307415 260056 647 0 0 0 0 0 4766329 42958 0 0 0 0 0 0 sit0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
이런식으로 나옵니다.
이걸 보면.. 가상 아이피에서 리퀘스트를 받아서 리얼 서버로 내려보낸 후에 리얼 서버가 루프백으로 사용자에게 전송 해 주는 것이 아니라 다시 VIP를 가지고 있는 로드발란서의 NIC을 이용해서 사용자에게 응답하는것 같은데요. 이렇게 되면 Direct return의 구현이 재대로 안된것 아닌가요?;
제가 뭘 잘못이해하고 있는게 있는지. 답변 부탁드립니다.
Forums:
댓글 달기