已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 氟西汀中毒临床查房
- 十五五小镇青年健康觉醒:智能多导睡眠监测消费意愿调研
- 十五五智能安全管理平台:拉美市场跨境支付安全与本地化策略
- 十五五智能分段控制灯银发族健康照明需求图谱
- 中东市场掘金:智慧储能云平台在高温环境下的技术适配性
- (新)采购管理制度2篇
- 2026年物流行业OEMODM向自主品牌升级的发展趋势报告
- 2026年康复辅具行业市场动态与竞争格局分析
- 2026年物流行业智能化升级报告及技术应用
- 2026年新能源行业氢燃料电池技术报告
- 高盛-中国2027年展望:阻力减少不确定性增加
- 2026年国家医保药品目录新增药品名单
- 2026年感控知识竞赛试题(含答案)
- 2026年三力测试全部模拟试题(含答案)
- 配电柜转运方案
- QC/T 783-2026摩托车用车速传感器
- 动物疫病防治员考试题库及答案
- (2026年秋)语文人教版七年级上册知识点大全
- 2026年广西高考物理真题含答案
- 工程项目专项施工方案编制要点及专家论证要求
- 儿童木工教育工具安全标准与课程分级体系
评论
0/150
提交评论