KeepAlived 安装
Posted littlewrong
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了KeepAlived 安装相关的知识,希望对你有一定的参考价值。
yum install -y gcc gcc-c++ openssl openssl-devel
目前keepalived最新版本下载:
[[email protected] ~]#wget -c http://www.keepalived.org/software/keepalived-1.2.12.tar.gz
[[email protected] ~]# tar zxvf keepalived-1.2.12.tar.gz
[[email protected] ~]# cd keepalived-1.2.12
安装编译环境:
[[email protected] ~]# yum install -y gcc gcc-c++ openssl openssl-devel
1
[[email protected] keepalived-1.2.12]# ./configure --prefix=/usr/local/keepalived //指定安装路径
[[email protected] keepalived-1.2.12]# make && make install //安装
将keepalived命令软连接到/usr/bin下
[[email protected] keepalived-1.2.12]# ln -s /usr/local/keepalived/sbin/keepalived /usr/bin/keepalived
添加启动脚本且方便用service keepalived start/stop/restart管理(如果没有init.d/keepalived则从源码目录拷贝)
[[email protected] keepalived-1.2.12]# cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/keepalived
[[email protected] keepalived-1.2.12]# chmod 755 /etc/init.d/keepalived //添加执行权限
[[email protected] keepalived-1.2.12]# chkconfig keepalived on //开机启动
修改/etc/init.d/keepalived中的程序路径
# Source configuration file (we set KEEPALIVED_OPTIONS there)
. /etc/sysconfig/keepalived
改为:
# Source configuration file (we set KEEPALIVED_OPTIONS there)
. /usr/local/keepalived/etc/sysconfig/keepalived
默认情况下,keepalived 会读取 /etc/keepalived 下keepalived.conf 文件
如果没有建立这个文件,keepalived也不会报错,但是会发现,所创建的关于keepalived的相关参数根本就没有生效。
[[email protected] keepalived-1.2.12]# mkdir /etc/keepalived
[[email protected] keepalived-1.2.12]# ln -s /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/keepalived.conf
启动测试:
[[email protected] keepalived-1.2.12]# service keepalived restart
停止 keepalived: [确定]
启动 keepalived: [确定]
安装完成
service keepalived restart
service keepalived stop
service keepalived start
systemctl start keepalived
systemctl restart keepalived
systemctl stop keepalived
以上是关于KeepAlived 安装的主要内容,如果未能解决你的问题,请参考以下文章