LB及其RS配置 3.1 负载均衡器配置配置 停止路由转发功能 [root@lvs01 linux]# sysctl -w net.ipv4.ip_forward=0 net.ipv4.ip_forward = 0 [root@lvs01 linux]# sysctl -w net.ipv4.conf.all.send_redirects=1 net.ipv4.conf.all.send_redirects = 1 [root@lvs01 linux]# sysctl -w net.ipv4.conf.default.send_redirects=1 net.ipv4.conf.default.send_redirects = 1 通过eth0绑定 [root@lvs01 linux]# sysctl -w net.ipv4.conf.eth0.send_redirects=1 net.ipv4.conf.eth0.send_redirects = 1 设置虚拟IP地址 [root@lvs01 linux]# ifconfig eth0:0 192.168.28.111 netmask 255.255.255.0 启用eth0:0 [root@lvs01 linux]# ifconfig eth0:0 up 清除ipvs规则表 [root@lvs_01 ~]# ipvsadm -C 查看集群分布 [root@lvs_01 ~]# ipvsadm -L -n IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn 为避免ARP解析 增加主机路由 [root@lvs01 linux]# /sbin/route add -host 192.168.28.111 dev eth0:0 [root@lvs_01 ~]# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.2.111 0.0.0.0 255.255.255.255 UH 0 0 0 eth0 192.168.28.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 0.0.0.0 192.168.28.2 0.0.0.0 UG 0 0 0 eth0 [root@lvs_01 ~]# [root@lvs01 linux]# ipvsadm -A -t 192.168.28.111:80 -s rr 在LB MASTER中增加真实服务器 [root@lvs01 linux]# ipvsadm -a -t 192.168.28.111:80 -r 192.168.28.134 -g -w 1 [root@lvs01 linux]# ipvsadm -a -t 192.168.28.111:80 -r 192.168.28.135 -g -w 2 [root@lvs_01 ~]# ipvsadm -L -n IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn TCP 192.168.28.111:80 rr -> 192.168.28.135:80 Route 1 0 0 -> 192.168.28.134:80 Route 1 0 0 注:Backup LB中安装配置和MASTER一致 3.2 RServer 应用真实服务器配置 [root@rs01 ~]# sysctl -w net.ipv4.ip_forward=0 忽略arp设置 [root@rs01 ~]# sysctl -w net.ipv4.conf.lo.arp_ignore=1 设置Arp宣告值 [root@rs01 ~]# sysctl -w net.ipv4.conf.lo.arp_announce=2 net.ipv4.conf.lo.arp_announce = 2 [root@rs01 ~]# sysctl -w net.ipv4.conf.all.arp_ignore=1 net.ipv4.conf.all.arp_ignore = 1 [root@rs01 ~]# sysctl -w net.ipv4.conf.all.arp_announce=2 net.ipv4.conf.all.arp_announce = 2 配置RS02中VIP地址 [root@rs01 ~]# /sbin/ifconfig lo:0 192.168.28.111 netmask 255.255.255.255 broadcast 192.168.28.111 up 查看路由表 [root@localhost html]# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.28.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 0.0.0.0 192.168.28.2 0.0.0.0 UG 0 0 0 eth0 增加主机虚拟IP [root@rs01 ~]# /sbin/route add -host 192.168.28.111 dev lo:0 再次查看路由表 [root@localhost html]# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.28.111 0.0.0.0 255.255.255.255 UH 0 0 0 lo 192.168.28.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 0.0.0.0 192.168.28.2 0.0.0.0 UG 0 0 0 eth0 虚拟IP已添加进来 注:RS02 配置过程与RS01一致,参照RS01配置
LVS-DR负载均衡-02
精选 转载文章标签 LVS-DR负载均衡-02 文章分类 负载均衡 服务器
上一篇:LVS-DR负载均衡-01
下一篇:LVS-DR负载均衡-03

提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
lvs负载均衡群集-直连路由模式(LVS-DR)
LVS负载均衡群集DR模式
LVS负载均衡群集DR模式