已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
接触负载均衡这个领域已经有一段时间了,但是对于linux下的负载均衡服务器的设置问题总是掌握的不得要领。那么现在,特意找来了一篇资料,跟大家一起分享。共同看看具体的配置过程是如何的。那么,具体的内容,我们一起来看文章吧。两台resin 服务器和两台apache服务器?一台负载均衡服务器,一共5台server。两台apache服务器ip地址:apache1 ip:01apache2 ip:10两台resin 服务器ip地址:resin1 ip:45resin2 ip:46一台负载均衡服务器ip地址:vip1:06 提供两台apache负载均衡的虚拟ip地址vip2:50 提供两台resin负载均衡的虚拟ip地址负载均衡服务器 ip地址09apache1 lvs相关配置如下:建一个shell脚本vi /usr/local/lvs/real.sh#!/bin/bash# set the Virtual IP Address/sbin/ifconfig lo:0 06 broadcast 06 netmask 55 up/sbin/route add -host 06 dev lo:0#off ARPecho 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# runsysctl -p#end保存退出将此脚本添加自启动文件rootweb1 # cat /etc/rc.local#!/bin/sh# This script will be executed *after* all the other init scripts.# You can put your own initialization stuff in here if you dont# want to do the full Sys V style init stuff./usr/local/lvs/real.shtouch /var/lock/subsys/localapache2服务器lvs配置和apache1相同resin1服务器lvs配置如下建一个shell脚本 vi /usr/local/realserver/real.sh#!/bin/bash# set the Virtual IP Address/sbin/ifconfig lo:0 50 broadcast 50 netmask 55 up/sbin/route add -host 50 dev lo:0#off ARPecho 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# runsysctl -p#end 将此脚本添加自启动文件rootresin1 # cat /etc/rc.local#!/bin/sh# This script will be executed *after* all the other init scripts.# You can put your own initialization stuff in here if you dont# want to do the full Sys V style init stuff./usr/local/realserver/real.shtouch /var/lock/subsys/localresin2服务器lvs配置和resin1相同负载均衡服务器配置安装libnet ?ipvsadm?ldirectord软件yum install libnetyum install ipvsadmyum install ldirectord*新建/usr/local/lvsdr/lvs.sh脚本vi /usr/local/lvsdr/lvs.shVIP1=06VIP2=50RIP1=01RIP2=10RIP3=45RIP4=46GW=#set the vritual IP Address/sbin/ifconfig eth0:0 $VIP1 broadcast $VIP1 netmask 55 up/sbin/route add -host $VIP1 dev eth0:0/sbin/ifconfig eth0:1 $VIP2 broadcast $VIP2 netmask 55 up/sbin/route add -host $VIP2 dev eth0:1#clear IPVS table/sbin/ipvsadm -C#Set LVS/sbin/ipvsadm -A -t $VIP1:80 -s rr/sbin/ipvsadm -a -t $VIP1:80 -r $RIP1:80 -g/sbin/ipvsadm -a -t $VIP1:80 -r $RIP2:80 -g/sbin/ipvsadm -A -t $VIP2:8080 -s wlc -p 120/sbin/ipvsadm -a -t $VIP2:8080 -r $RIP3:8080 -g/sbin/ipvsadm -a -t $VIP2:8080 -r $RIP4:8080-g#Run lvs/sbin/ipvsadm#end配置ldirectordrootlvsdr # cp /usr/share/doc/heartbeat-ldirectord-2.1.3/ldirectord.cf /etc/ha.dvi /etc/ha.d/ldirectord.cf# Global Directiveschecktimeout=3checkinterval=1#fallback=:80autoreload=yeslogfile=/var/log/ldirectord.log#logfile=local0#emailalert=adminx.y.z#emailalertfreq=3600#emailalertstatus=allquiescent=yes#VIP1=06 HTTPvirtual=06:80real=01:80 gatereal=10:80 gate#real=:80 gate#fallback=:80 gateservice=http#request=index.html#receive=Test Page#virtualhost=.auscheduler=rr#persistent=600#netmask=55protocol=tcp#checktype=negotiatecheckport=80#request=index.html#receive=Test Page#virtualhost=www.x.y.z#VIP2=50 RESINvirtual=50:8080real=45:8080 gatereal=46:8080 gate#real=:8080 gate#fallback=:80 gate#service=http#request=index.html#receive=Test Page#virtualhost=.auscheduler=wlcpersistent=600#netmask=55protocol=tcpchecktype=connectcheckport=8080#request=index.html#receive=Test Page#virtualhost=www.x.y.z加入自启动rootlvsdr # cat /etc/rc.local#!/bin/sh# This script will be executed *after* all the other init scripts.# You can put your own initialization stuff in here if you dont# want to do the full Sys V style init stuff.t
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 防暑降温设备销售合同合同
- 电梯改造升级合同模板
- 学校集中定点采购制度
- 医院宣传科采购制度
- 对材料采购管理制度
- 气体采购制度
- 幼儿园采购工作管理制度
- 公司采购材料制度
- 云南玉溪市易门县2025-2026学年高一上学期期末考试历史试卷(无答案)
- 广东省东莞市2024-2025学年七年级历史下学期期末教学质量检测题(无答案)
- 2026年浙江省衢州市六校联谊初三百日冲刺考试英语试题含解析
- 一次性使用止血套环产品技术要求北京中诺恒康生物
- 政法单位联席会议制度
- 休克诊疗规范课件
- 2026年陕西航空职业技术学院单招职业倾向性考试题库及一套答案详解
- (甘肃一模)2026年甘肃省高三年级第一次模拟考试英语试题(含答案)+听力音频+听力原文
- 2025-2026学年教科版(新教材)初中信息科技八年级第二学期教学计划及进度表
- XX医院关于2025年医保基金监管专项检查工作的整改报告
- 钢丝pe施工方案(3篇)
- 2026年医疗AI辅助手术报告
- 新版二年级下册道德与法治12《见贤要思齐》教学课件
评论
0/150
提交评论