Keepalived安装配置

Eave 2016.01.27 10:21

一、安装Keepalived

下载地址:http://www.keepalived.org/software/

$ wget "http://www.keepalived.org/software/keepalived-1.2.19.tar.gz"
$ tar -zxf keepalived-1.2.19.tar.gz
$ cd keepalived-1.2.19
$ ./configure --prefix=/usr/local/keepalived
$ make && make install

二、建立启动脚本

$ cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/keepalived

三、修改/etc/init.d/keepalived

查找

. /etc/sysconfig/keepalived

修改为

. /usr/local/keepalived/etc/sysconfig/keepalived

查找

daemon keepalived ${KEEPALIVED_OPTIONS}

修改为

daemon /usr/local/keepalived/sbin/keepalived ${KEEPALIVED_OPTIONS}

四、修改/usr/local/keepalived/etc/sysconfig/keepalived

查找

KEEPALIVED_OPTIONS="-D"

修改为

KEEPALIVED_OPTIONS="-D -f /usr/local/keepalived/etc/keepalived/keepalived.conf"

启动Keepalived

$ /etc/init.d/keepalived start

五、设置开机启动keepalived

$ chkconfig --add keepalived
$ chkconfig keepalived on

http://www.linuxidc.com/Linux/2012-08/69383.htm