Keepalived做Nginx的高可用,企业版简单介绍

一、编译安装keepalived-1.2.8

下载地址:

注意最新的不一定是最好的,所以选择1.2.8

tar xf keepalived-1.2.8.tar.gz

cd keepalived-1.2.8

mkdir -p /data/soft/keepalived

./configure --prefix=/data/soft/keepalived
注意:编译安装之前,可能需要先安装gcc和一些额外的包,请自行解决

make && make install
编译报错1
../include/vrrp_ipaddress.h:32:27: error: linux/if_addr.h: No such file or directory
In file included from ../include/vrrp.h:31,
from ../include/smtp.h:34,
from smtp.c:27:
../include/vrrp_ipaddress.h:41: error: field ‘ifa’ has incomplete type
make: * [smtp.o] Error 1
make: Leaving directory `/root/keepalived-1.2.7/keepalived/core'
make:
[all] Error 1
make: Leaving directory `/root/keepalived-1.2.7/keepalived'
make: *
* [all] Error 2
原因及解决办法:
这是kernel-headers软件版本过低造成的

yum -y install kernel-headers
问题解决
编译报错2
make: * [vrrp_ipaddress.o] Error 1
make: Leaving directory `/data/soft/keepalived-1.2.9/keepalived/vrrp'
make:
[all] Error 1
make: Leaving directory `/data/soft/keepalived-1.2.9/keepalived'
make: *
* [all] Error 2
解决办法:
将编译keepalived-1.2.9.tar.gz改成编译keepalived-1.2.8.tar.gz即可
转移文件到正确的位置

mkdir /etc/keepalived

pwd
/data/soft/keepalived

cp etc/keepalived/keepalived.conf /etc/keepalived/

cp etc/rc.d/init.d/keepalived /etc/init.d/

cp etc/sysconfig/keepalived /etc/sysconfig/

cp sbin/keepalived /usr/sbin/

chkconfig --add keepalived

service keepalived start
Starting keepalived: [ OK ]

chkconfig --add keepalived

chkconfig keepalived on

Keepalived 的详细介绍请点这里
Keepalived 的下载地址请点这里

推荐阅读:

CentOS 6.3下Haproxy+Keepalived+Apache配置笔记

Haproxy + KeepAlived 实现WEB群集 on CentOS 6

Keepalived+Haproxy配置高可用负载均衡

Haproxy+Keepalived构建高可用负载均衡

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/2fc188ce9366ddf7d10afb6507d3e546.html