keepalived安装详解

kernel version:2.6.32-696.16.1.el6.x86_64
keepalived version:1.4.2

备注:之前我多次尝试编译安装1.3.6~1.3.9,make报错,在GitHub提交issues后,项目维护者: pqarmitage回复, 为了让keepalived构建,必须使用–disable-libipset配置选项。他不确定这是否是由于RedHat将Linux 2.6.39的ipset功能反向移植到2.6.32,或者是否需要修复keepalived,同时他提交6cdd015(git版本tag)尝试解决这个问题,得到反馈后再试问题还没得到彻底解决,最终他再次提交e941d1b,已完全修复了使用ipset构建的问题,因此不再需要–disable-libipset选项。 链接:https://github.com/acassen/keepalived/issues/703#issuecomment-346334627

1、下载并解压后查看INSTALL文件内容,按提示解决依赖: 必装包:openssl-devel libnl3-devel ipset-devel iptables-devel libnfnetlink-devel
如需对SNMP支持,则net-snmp-devel不能少
如要对DBUS支持,则安装glib2-devel
要支持JSON,则安装json-c-devel
为了构建文档,需要安装以下软件包:python-sphinx epel-release python-sphinx_rtd_theme
对于latex或pdf文件,还需要以下内容:latexmk texlive texlive-titlesec texlive-framed texlive-threeparttable texlive-wrapfig texlive-multirow

对于一般生产场景,建议:
yum -y install openssl-devel libnl3-devel ipset-devel iptables-devel libnfnetlink-devel net-snmp-devel glib2-devel json-c-devel gcc gcc-c++

请注意gcc gcc-c++也是前提 查看编译选项,按需而定:
./configure –help
./configure –prefix=/usr/local/keepalived
make && make install
cp /usr/local/keepalived/sbin/keepalived /usr/sbin/或# ln -s /usr/local/keepalived/sbin/keepalived /usr/sbin/keepalived
cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/
mkdir -p /etc/keepalived
cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived
cp keepalived/etc/init.d/keepalived /etc/init.d/
mkdir -p /usr/local/keepalived/var/log
mkdir -p /etc/keepalived/scripts
ln -s /etc/rc.d/init.d/keepalived.init /etc/rc.d/rc3.d/S99keepalived

附排查相关命令:
lsmod |grep ip_vs 查看ip_vs内核模块是否有被加载;
modprobe ip_vs 如果没有显示,这执行左边的命令将ip_vs模块加载到内核,再次查看就有了

Leave a Comment

Your email address will not be published. Required fields are marked *

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据