安装步骤如下:
ln -s /usr/src/kernels/2
.6.9-89.0.9.EL-smp-x86_64/ /usr/src/linux
2.6.9-89.0.9.EL-smp-x86_64与uname -a内核配对。
下载wget
wget
安装tar zxvf ipvsadm-1.24.tar.gz
cd ipvsadm-1.24
make && make install
cd ..
tar zxvf keepalived-1.1.15.tar.gz
cd keepalived-1.1.15
注意项
引用
Centos5.0以下需要修改以下configure才能通过。
vi /usr/src/linux/include/linux/types.h
/*
typedef __u16 __bitwise __sum16;
typedef __u32 __bitwise __wsum;
*/
./configure
make && make install
cp /usr/local/etc/rc.d/init.d/keepalived /etc/rc.d/init.d/
cp /usr/local/etc/sysconfig/keepalived /etc/sysconfig/
mkdir /etc/keepalived
cp /usr/local/etc/keepalived/keepalived.conf /etc/keepalived/
cp /usr/local/sbin/keepalived /usr/sbin/
service keepalived start
为了配合LVS平台,还需如下操作1、
2、配置master端流量rrd数据采集
cd /home
wget
tar -zxvf lvs-rrd.tar.gz
vi lvs-rrd/lvs.rrd.update
根据用户实际情况来修改如下参数
引用
RRDTOOL="/usr/bin/rrdtool"
IPVSADM="/sbin/ipvsadm"
WORKDIR="/home/lvs-rrd/performance"
3、定制采集作业
*/2 * * * * /home/lvs-rrd/lvs.rrd.update 2> /dev/null > /dev/null
4、LVS管理平台端会定期来捉取performance中的*.rrd文件,用户可以通过ssh或ftp,系统默认采用rsync+ssh方式,配置可参考
实践rsync+ssh实现代码同步问题总结1、make keepalived时提示:
make[2]: Leaving directory `/home/install/lvs/keepalived-1.1.15/keepalived/core'
make[2]: Entering directory `/home/install/lvs/keepalived-1.1.15/keepalived/check'
gcc -g -O2 -I/usr/src/linux/include -I../include -I../../lib -Wall -Wunused -Wstrict-prototypes -D_KRNL_2_6_ -D_WITH_LVS_ -D_HAVE_IPVS_SYNCD_ -D_WITHOUT_VRRP_ -c check_daemon.c
In file included from /usr/src/linux/include/linux/netlink.h:5,
from ../include/vrrp_netlink.h:35,
from check_daemon.c:40:
/usr/src/linux/include/linux/types.h:158: error: syntax error before "__sum16"
/usr/src/linux/include/linux/types.h:158: warning: type defaults to `int' in declaration of `__sum16'
/usr/src/linux/include/linux/types.h:158: warning: data definition has no type or storage class
/usr/src/linux/include/linux/types.h:159: error: syntax error before "__wsum"
/usr/src/linux/include/linux/types.h:159: warning: type defaults to `int' in declaration of `__wsum'
/usr/src/linux/include/linux/types.h:159: warning: data definition has no type or storage class
make[2]: *** [check_daemon.o] Error 1
make[2]: Leaving directory `/home/install/lvs/keepalived-1.1.15/keepalived/check'
make[1]: *** [all] Error 1
make[1]: Leaving directory `/home/install/lvs/keepalived-1.1.15/keepalived'
make: *** [all] Error 2
解决:
引用
vi /usr/src/linux/include/linux/types.h
/*
typedef __u16 __bitwise __sum16;
typedef __u32 __bitwise __wsum;
*/
2、master、backup的/var/log/messagse显示
Nov 23 17:46:41 SN2008-06-070 Keepalived_vrrp: receive an invalid ip number count associated with VRID!
Nov 23 17:46:41 SN2008-06-070 Keepalived_vrrp: bogus VRRP packet received on eth0 !!!
Nov 23 17:46:41 SN2008-06-070 Keepalived_vrrp: VRRP_Instance(VI_1) Dropping received VRRP packet...
Nov 23 17:46:42 SN2008-06-070 Keepalived_vrrp: receive an invalid ip number count associated with VRID!
Nov 23 17:46:42 SN2008-06-070 Keepalived_vrrp: bogus VRRP packet received on eth0 !!!
Nov 23 17:46:42 SN2008-06-070 Keepalived_vrrp: VRRP_Instance(VI_1) Dropping received VRRP packet...
解决:
引用
修改 virtual_router_id 的值,与网络中不能重复。
3、在/var/log/messages中Keepalived_vrrp不生效,即无vrrp日志。
解决:
引用
重新编译源码包,可能是由于修改types.h后才configure。