Linux下负载均衡软件LVS配置(VS/DR)教程

昝辉Zac Zac的SEO博客,坚持12年,优化成为生活。

LVS负载均衡有很多的方式今天,本文章介绍的是负载均衡VS/DR模式了,对于这个模式下面小编会简单的给各位介绍一下,有兴趣的可进来看看.

VS/DR:即(Virtual Server via Direct Routing)

也就是用直接路由技术实现虚拟服务器,它的连接调度和管理与VS/NAT和VS/TUN中的一样,但它的报文转发方法又有不同,VS/DR通过改写请求报文的MAC地址,将请求发送到Real Server,而Real Server将响应直接返回给客户,免去了VS/TUN中的IP隧道开销,这种方式是三种负载调度机制中性能最高最好的,但是必须要求Director Server与Real Server都有一块网卡连在同一物理网段上.

例子:

  1. DIP:172.28.95.220
  2. VIP:172.28.95.245
  3. RIP:172.28.95.221(222)

负载调度器:

  1. [root@LVS-GS001ipvsadm-1.24]#ifconfigeth1:1172.28.95.245netmask255.255.255.0up
  2. [root@LVS-GS001ipvsadm-1.24]#ifconfig
  3. eth1Linkencap:EthernetHWaddr00:15:5D:C7:83:7D
  4. inetaddr:172.28.95.220Bcast:172.28.95.255Mask:255.255.240.0
  5. eth1:1Linkencap:EthernetHWaddr00:15:5D:C7:83:7D
  6. inetaddr:172.28.95.245Bcast:172.28.95.255Mask:255.255.255.0
  7. UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1
  8. Interrupt:9Baseaddress:0xc000
  9. [root@LVS-GS001ipvsadm-1.24]#ipvsadm
  10. IPVirtualServerversion1.2.1(size=4096)
  11. ProtLocalAddress:PortSchedulerFlags
  12. ->RemoteAddress:PortForwardWeightActiveConnInActConn
  13. [root@LVS-GS001ipvsadm-1.24]#ipvsadm--help
  14. [root@LVS-GS001ipvsadm-1.24]#ipvsadm--set30560#--settcptcpfinudpsetconnectiontimeoutvalues
  15. [root@LVS-GS001ipvsadm-1.24]#ipvsadm-A-t172.28.95.245:80-swrr-p20#-Aaddvirtualservicewithoptions#-sscheduleroneofrr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq,thedefaultscheduleriswlc.
  16. [root@LVS-GS001ipvsadm-1.24]#ipvsadm-L-n
  17. IPVirtualServerversion1.2.1(size=4096)
  18. ProtLocalAddress:PortSchedulerFlags
  19. ->RemoteAddress:PortForwardWeightActiveConnInActConn
  20. TCP172.28.95.245:80wrrpersistent20
  21. [root@LVS-GS001ipvsadm-1.24]#ipvsadm-a-t172.28.95.245:80-r172.28.95.221:80-g-w1
  22. [root@LVS-GS001ipvsadm-1.24]#ipvsadm-a-t172.28.95.245:80-r172.28.95.222:80-g-w1
  23. [root@LVS-GS001ipvsadm-1.24]#ipvsadm-L-n
  24. IPVirtualServerversion1.2.1(size=4096)
  25. ProtLocalAddress:PortSchedulerFlags
  26. ->RemoteAddress:PortForwardWeightActiveConnInActConn
  27. TCP172.28.95.245:80wrrpersistent20
  28. ->172.28.95.222:80Route100
  29. ->172.28.95.221:80Route100
  30. Real-Server:
  31. [root@RealServer001~]#ifconfiglo:221172.28.95.245:80netmask255.255.255.255up
  32. [root@RealServer001~]#echo"1">/proc/sys/net/ipv4/conf/lo/arp_ignore--phpfensi.com
  33. [root@RealServer001~]#echo"2">/proc/sys/net/ipv4/conf/lo/arp_announce
  34. [root@RealServer001~]#echo"1">/proc/sys/net/ipv4/conf/all/arp_ignore
  35. [root@RealServer001~]#echo"2">/proc/sys/net/ipv4/conf/all/arp_announce

相关广告
  • Linux下负载均衡软件LVS配置(VS/DR)教程 Linux下负载均衡软件LVS配置(VS/DR)教程 Linux下负载均衡软件LVS配置(VS/DR)教程
相关阅读

Linux下负载均衡软件LVS配置(VS/DR)教程

2019/10/10 17:46:35 | 谷歌SEO算法 | 友情链接作弊