keepalived1.4.0安装启动卸载
下载地址:http://www.keepalived.org/
2.安装keepalived
解压
tar -zxvf keepalived-1.4.0.tar.gz
安装gcc命令
yum install -y gcc openssl-devel popt-devel
安装好gcc后
cd keepalived-1.4.0进入解压的keepalived目录下,执行
./configure --prefix=/usr/local/keepalived
在keepalived-1.4.0目录里make编译和安装
make && make install
以上步骤如果没有错误,则说明编译安装成功。但此时还不能直接使用安装的keepalived,需要拷贝几个文件到指定的目录下才可以直接使用。拷贝的文件如下:
cp keepalived-1.4.0/keepalived/etc/init.d/keepalived /etc/init.d/ mkdir /etc/keepalived cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/ cp keepalived-1.4.0/keepalived/etc/sysconfig/keepalived /etc/sysconfig/ cp /usr/local/keepalived/sbin/keepalived /usr/sbin/
复制完后就可以启动keepalived
查看指定keepalived安装目录
whereis keepalived
启动之前执行
systemctl daemon-reload
启动keepalived
systemctl start keepalived.service
停止keepalived
systemctl stop keepalived.service
验证是否启动成功
ps -aux | grep keepalived
正常启动后,这里有3条记录,其中一个是父进程,负责监控其子进程。一个是vrrp子进程,另外一个是checkers子进程。其他情况说明启动失败。
设置开启启动:
chkconfig keepalived on
2.keepalived 卸载
进入keepalived解压目录的keepalived目录下,
cd /root/java/keepalived/keepalived-1.4.0
执行命令:
make uninstall
然后删除我们安装时候拷贝相关文件
rm -rf /etc/init.d/keepalived
rm -rf /etc/keepalived/
rm -rf /etc/sysconfig/keepalived
rm -rf /usr/sbin/keepalived
rm -rf /lib/systemd/system/keepalived.service
这样keepalived就删除完了