LVS+Keepalived负载均衡实施方案

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

LVS+Keepalived负载均衡实施方案1LVS+Keepalived负载均衡实施方案LVS+Keepalived负载均衡实施方案2目录第一章文档简介........................................................................................................................................3第二章软件环境........................................................................................................................................3第三章系统基本配置.................................................................................................................................4LVS、Keepalived依赖库安装..................................................................................................................4IP规划......................................................................................................................................................4第四章LVS安装配置..................................................................................................................................5安装..........................................................................................................................................................5第五章Keepalived安装配置......................................................................................................................6安装..........................................................................................................................................................6将keepalived配置成系统服务...............................................................................................................6修改主keepalived配置文件...................................................................................................................6修改备keepalived配置文件...................................................................................................................6配置主备机LVSrealserver脚本..............................................................................................................6第七章测试................................................................................................................................................8安装Apache.............................................................................................................................................8启动Keepalived........................................................................................................................................8执行lvs_realserver.sh..............................................................................................................................8分别访问主备机realserver.....................................................................................................................8通过虚拟IP访问.....................................................................................................................................8切换测试..................................................................................................................................................9相关命令..................................................................................................................................................9LVS+Keepalived负载均衡实施方案3第一章文档简介LVS是运行在Linux平台上的一款开源软件,主要功能是实现Linux平台的负载均衡。这款软件在业界有着很高的知名度,同时在国内互联网公司有着很高的使用率,适合用于构建大型网站系统的负载均衡平台。Keepalived是运行在LVS上面的双机管理软件,LVS配合Keepalived使用可以构建热备双机结构,实现主备机的切换。通过本文档指导,可以架设一套LVS+keepalived结构的负载均衡双机热备系统。第二章软件环境软件版本centos6.6LVS1.26keepalived1.2.7LVS+Keepalived负载均衡实施方案4第三章系统基本配置LVS、Keepalived依赖库安装LVS、Keepalived安装需要一些软件包的支持,在两台LVS服务器上安装下列库yum-yinstallgccgcc-c++makepcrepcre-develkernel-developenssl-devellibnl-develpopt-develpopt*IP规划LVS_MASTER192.168.184.139LVS_BACKUP192.168.184.140LVS_VIP192.168.184.101WEB_realserver1192.168.184.139(这里是测试方便,正常情况应该和LVS_MASTER区分开)WEB_realserver2192.168.184.140(同上)配置路由转发(LVS主备机上)echo1/proc/sys/net/ipv4/ip_forward创建Keepalived安装目录mkdir-p/usr/local/frontserver/keepalivedLVS+Keepalived负载均衡实施方案5第四章LVS安装配置安装分别在LVS_MASTER和LVS_BACKUP上安装LVS,获取软件源wget建立内核的软连接,否则LVS安装编译会失败ln-s/usr/src/kernels/2.6.32-504.23.4.el6.x86_64//usr/src/linux(注意:如果/usr/src/kernels/下没有内核,运行yum-yinstallkernel-devel)安装tarzxvfipvsadm-1.26.tar.gzcdipvsadm-1.26make&&makeinstallLVS+Keepalived负载均衡实施方案6第五章Keepalived安装配置安装wget=/usr/local/frontserver/keepalivedmake&&makeinstall将keepalived配置成系统服务cp/usr/local/frontserver/keepalived/etc/rc.d/init.d/keepalived/etc/init.d/cp/usr/local/frontserver/keepalived/etc/sysconfig/keepalived/etc/sysconfig/mkdir-p/etc/keepalived/cp/usr/local/frontserver/keepalived/etc/keepalived/keepalived.conf/etc/keepalived/cp/usr/local/frontserver/keepalived/sbin/keepalived/usr/sbin/修改主keepalived配置文件vi/etc/keepalived/keepalived.conf修改备keepalived配置文件vi/etc/keepalived/keepalived.conf配置主备机LVSrealserver脚本vi~/lvs_realserver.shLVS+Keepalived负载均衡实施方案7LVS+Keepalived负载均衡实施方案8第七章测试安装Apache分别在两台realserver上安装Apacheyum-yinstallhttpdcd/var/

1 / 9
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功