安装keepalived

keepalived:http://www.keepalived.org/index.html
[quote]
它是一个基于VRRP协议来实现的WEB服务高可用方案,可以利用其来避免单点故障。一个WEB服务至少会有2台服务器运行Keepalived,一台为主服务器(MASTER),一台为备份服务器(BACKUP),但是对外表现为一个虚拟IP,主服务器会发送特定的消息给备份服务器,当备份服务器收不到这个消息的时候,即主服务器宕机的时候,备份服务器就会接管虚拟IP,继续提供服务,从而保证了高可用性。(摘)
[/quote]
[img]http://dl2.iteye.com/upload/attachment/0085/9608/46bfd6b2-60fc-3eb7-ad77-5ba48908e9b5.png[/img]

1.安装ipvsadm
yum -y install ipvsadm
或者

wget http://www.linuxvirtualserver.org/software/kernel-2.6/ipvsadm-1.26.tar.gz
tar -zxvf ipvsadm-1.26.tar.gz
cd ipvsadm-1.26
make&&make install

错误处理一:

In file included from libipvs.h:13,
from libipvs.c:23:
ip_vs.h:15:29: error: netlink/netlink.h: No such file or directory
ip_vs.h:16:31: error: netlink/genl/genl.h: No such file or directory
ip_vs.h:17:31: error: netlink/genl/ctrl.h: No such file or directory

这个需要安装 libnl-devel 包, yum install libnl-devel 就可以了。
错误处理二:

ipvsadm.o: In function `parse_options':
/ipvsadm-1.26/ipvsadm.c:432: undefined reference to `poptGetContext'
/ipvsadm-1.26/ipvsadm.c:435: undefined reference to `poptGetNextOpt'
/ipvsadm-1.26/ipvsadm.c:660: undefined reference to `poptBadOption'
/ipvsadm-1.26/ipvsadm.c:502: undefined reference to `poptGetNextOpt'
/ipvsadm-1.26/ipvsadm.c:667: undefined reference to `poptStrerror'
/ipvsadm-1.26/ipvsadm.c:667: undefined reference to `poptBadOption'
/ipvsadm-1.26/ipvsadm.c:670: undefined reference to `poptFreeContext'
/ipvsadm-1.26/ipvsadm.c:677: undefined reference to `poptGetArg'
/ipvsadm-1.26/ipvsadm.c:678: undefined reference to `poptGetArg'
/ipvsadm-1.26/ipvsadm.c:679: undefined reference to `poptGetArg'
/ipvsadm-1.26/ipvsadm.c:690: undefined reference to `poptGetArg'
/ipvsadm-1.26/ipvsadm.c:693: undefined reference to `poptFreeContext'

安装popt-static:yum install popt-static
重新make&&make install安装成功。

2.安装keepalived

wget http://www.keepalived.org/software/keepalived-1.2.7.tar.gz
tar –zxvf keepalived-1.2.7.tar.gz
cd keepalived-1.2.7
./configure
make && make install

错误处理一:

configure: error:
!!! OpenSSL is not properly installed on your system. !!!
!!! Can not include OpenSSL headers files. !!!

需要安装opendevel:yum -y install openssl-devel
重新make&&make install安装成功。

3.配置为服务
cp /usr/local/etc/rc.d/init.d/keepalived /etc/rc.d/init.d/
cp /usr/local/etc/sysconfig/keepalived /etc/sysconfig/
ln -s /usr/local/sbin/keepalived /usr/sbin/
可以这样启动/停止:
service keepalived start|stop
设为开机启动:
chkconfig keepalived on
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值