编译安装问题:
1../configure
Keepalived configuration
------------------------
Keepalived version : 1.1.15
Compiler : gcc
Compiler flags : -g -O2
Extra Lib : -lpopt -lssl -lcrypto
Use IPVS Framework : Yes
IPVS sync daemon support : Yes
Use VRRP Framework : Yes
Use LinkWatch : No
Use Debug flags : No
如果Use IPVS Framework 为No 则使用keepalived启用后将无法条用ipvsadm,所以
安装时需要指定kernel:
./configure --with-kernel-dir=/usr/src/kernels/2.6.18-194.32.1.el5-i686
ü 2. Can not include OpenSSL
!!! OpenSSL is not properly installed on your system. !!!
!!! Can not include OpenSSL headers files. !!!
提示open-ssl未安装:yum openssl-devel
ü .make时出现如下乱码错误:
check_http.c:459: 警告:对指针赋值时目标与指针有/无符号不一致
check_http.c:461: 警告:传递参数 1 (属于 ‘sprintf’) 给指针时目标与指针有/无符号不一致
check_http.c:463: 警告:传递参数 1 (属于 ‘strlen’) 给指针时目标与指针有/无符号不一致
check_http.c:463: 警告:传递参数 2 (属于 ‘__builtin_strcmp’) 给指针时目标与指针有/无符号不一致
check_http.c:463: 警告:传递参数 2 (属于 ‘__builtin_strcmp’) 给指针时目标与指针有/无符号不一致
check_http.c:463: 警告:传递参数 1 (属于 ‘strlen’) 给指针时目标与指针有/无符号不一致
check_http.c:463: 警告:传递参数 2 (属于 ‘__builtin_strcmp’) 给指针时目标与指针有/无符号不一致
check_http.c:463: 警告:传递参数 2 (属于 ‘__builtin_strcmp’) 给指针时目标与指针有/无符号不一致
尽量保持kernel版本一致,如:
[root@hbchen ~]# rpm -qa|grep kernel
kernel-2.6.18-164.el5
kernel-headers-2.6.18-164.el5
kernel-devel-2.6.18-164.el5
(keepalived对于一些kernel不兼容,所以kernel都要保持一致,Version 1.1.19以下的版本都兼容性比较好,
所以安装1.1.19以上的版本make时会出现很多乱七八糟的错误)
注意下这里2.6.18-194.32.1.el5-i686要替换为你自己系统的核心,用uname -r 查询
解决方法:yum install kernel-devel
ln -s /usr/src/kernels/2.6.9-22.EL-i686/ /usr/src/linux
ü ip_vs文件错误
/usr/include/sys/types.h:62: 错误:与 ‘dev_t’ 类型冲突
/usr/src/kernels/2.6.18-194.3.1.el5-i686/include/linux/types.h:22: 错误:‘dev_t’ 的上一个声明在此
/usr/include/sys/types.h:67: 错误:与 ‘gid_t’ 类型冲突
/usr/src/kernels/2.6.18-194.3.1.el5-i686/include/linux/types.h:54: 错误:‘gid_t’ 的上一个声明在此
/usr/include/sys/types.h:72: 错误:与 ‘mode_t’ 类型冲突
/usr/src/kernels/2.6.18-194.3.1.el5-i686/include/linux/types.h:24: 错误:‘mode_t’ 的上一个声明在此
/usr/include/sys/types.h:77: 错误:与 ‘nlink_t’ 类型冲突
/usr/src/kernels/2.6.18-194.3.1.el5-i686/include/linux/types.h:25: 错误:‘nlink_t’ 的上一个声明在此
/usr/include/sys/types.h:82: 错误:与 ‘uid_t’ 类型冲突
/usr/src/kernels/2.6.18-194.3.1.el5-i686/include/linux/types.h:53: 错误:‘uid_t’ 的上一个声明
.找到ip_vs.h文件.
find / -name ip_vs.h copy to /usr/include/net下
[root@hbchen /]# cp /usr/src/kernels/2.6.18-164.el5-i686/include/net/ip_vs.h /usr/include/net/
/usr/src/kernels/2.6.18-194.32.1.el5-i686/include/net/ip_vs.h 这个是我系统上的路径,
2.6.18-194.32.1.el5-i686要替换为你自己系统的核心没有这个路径的话用find命令查找
find / -name ip_vs.h (若找不到这个文件,你先要先把kernel-devel 安装好)
ü 加载ipvs模块
3.实现lvs群集的两个重要部件是ipvs内核模块和ipvsadm工具包。当前内核版本的系统已经包含ipvs内核模块,
但默认并没有加载到内核中,可以手工加载或安装ipvsadm之后会被加载。使用modprobe命令手工加载ipvs模块
并查询模块是否加
[root@hbchen ~]# modprobe ip_vs
[root@hbchen ~]# lsmod |grep ip_vs
ip_vs_wlc 6080 1
ü Keepalived_vrrp不生效
在/var/log/messages中Keepalived_vrrp不生效,即无vrrp日志
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...
重新编译源码包,可能是由于修改types.h后才configure
Ipvsadm启动问题
Ipvsadm可以通过脚本直接启动不用启动服务(service ipvsadm start)
若要直接启动,报错如下:
Applying IPVS configuration: /etc/init.d/ipvsadm: line 62: /etc/sysconfig/ipvsadm: 没有那个文件或目录
[失败]
[root@localhost init.d]# service ipvsadm save
Saving IPVS table to /etc/sysconfig/ipvsadm: [确定]
[root@localhost init.d]# service ipvsadm start
Clearing the current IPVS table: [确定]
Applying IPVS configuration: [确定]
此时只需要保存ipvsadm表即可!(service ipvsadm save)