Linux/Python学习论坛-京峰教育

 找回密码
 立即注册

一键登录:

搜索
热搜: 活动 交友 discuz
查看: 522|回复: 0

天涯LVS管理平台:部署LVS+Keepalived平台

[复制链接]

238

主题

288

帖子

1925

积分

超级版主

Rank: 8Rank: 8

积分
1925
QQ
发表于 2015-3-18 10:58:49 | 显示全部楼层 |阅读模式
安装步骤如下:


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 http://www.linuxvirtualserver.or ... ipvsadm-1.24.tar.gz
wget http://www.keepalived.org/software/keepalived-1.1.15.tar.gz
安装


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平台,还需如下操作


安装RRDTOOL
配置master端流量rrd数据采集
cd /home
wget http://tianyalvs.googlecode.com/files/lvs-rrd.tar.gz
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。

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|京峰教育,只为有梦想的人 ( 京ICP备15013173号 )

GMT+8, 2020-1-26 08:13 , Processed in 0.023608 second(s), 11 queries , Redis On.

快速回复 返回顶部 返回列表