欢迎来到天天文库
浏览记录
ID:1773110
大小:42.00 KB
页数:4页
时间:2017-11-13
《lvs负载均衡dr模式》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、LVS负载均衡群集DR模式环境架设:调度器ip,eth0192.168.0.99虚拟ip,eth0:0192.168.0.200A服务器ip,eth0192.168.0.10回环口ip,lo:0192.168.0.200B服务器ip,eth0192.168.0.11回环口ip,lo:0192.168.0.200实验1步骤:一、调度器配置1)配置调度器ip地址//setup192.168.0.992)安装ipvsadm管理器[root@LVS-Master/]#mount/dev/cdrom/media/[
2、root@LVS-Master/]#cd/media/Cluster[root@LVS-MasterCluster]#rpm-ivhipvsadm-1.24-8.1.i386.rpm3)配置VIP设定脚本[root@LVS-Master~]#vi/opt/vip.sh#!/bin/bashifconfigeth0:0192.168.0.200broadcast192.168.0.200netmask255.255.255.255uprouteadd-host192.168.0.200deveth0:0ip
3、vsadm–Cipvsadm–A–t192.168.0.200:80–srr–p600ipvsadm–a–t192.168.0.200:80–r192.168.0.10-gipvsadm–a–t192.168.0.200:80–r192.168.0.11–gipvsadm4)设置脚本可执行权限[root@LVS-Master~]#chmodu+x/opt/vip.sh5)执行VIP脚本[root@LVS-Master~]#../opt/vip.sh6)查看ipvsadm列表[root@LVS-Master
4、~]#ipvsadm–l//查看ipvsadm列表IPVirtualServerversion1.2.1(size=4096)ProtLocalAddress:PortSchedulerFlags->RemoteAddress:PortForwardWeightActiveConnInActConnTCP192.168.0.200:httprr->192.168.0.10:httpRoute100->192.168.0.11:httpRoute100Vim/etc/sysctl.confNet.ipv4.
5、ip_forward=1//开启中继转发Sysctl–p//执行生效7)把脚本写入到开机启动项里二、A.B服务器上的配置提供服务的A和B不需要安装任何IPVS软件,只需要设置在开机后自动执行以下脚本:1)在A服务器上的设置配置真实ip为192.168.0.10//setup[root@localhost~]#vi/opt/lvs.sh//编写脚本#!/bin/bashifconfiglo:0192.168.0.200broadcast192.168.0.200netmask255.255.255.255u
6、prouteadd-host192.168.0.200devlo: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[root@localhost~]#chmodu+x/opt/lvs.
7、sh//添加脚本lvs.sh的执行权限[root@localhost~]#../opt/lvs.sh//执行脚本[root@localhost~]#echo"wosAfuwuqi">/var/www/html/index.html//在A添加测试页[root@localhost~]#servciehttpdrestart//重启web服务器7)把脚本写入到开机启动项里2)在B服务器上的设置配置真实ip为192.168.0.11//setup[root@localhost~]#vi/opt/lvs.dr//
8、编写lvs.dr脚本#!/bin/bashifconfiglo:0192.168.0.200broadcast192.168.0.200netmask255.255.255.255uprouteadd-host192.168.0.200devlo:0echo"1">/proc/sys/net/ipv4/conf/lo/arp_ignoreecho"2">/proc/sys/net/ipv4/conf/lo/arp_announ
此文档下载收益归作者所有