keepalived安装

两台Linux 

 

环境搭建

 安装keepalived

1.下载keepalived

wget http://www.keepalived.org/software/keepalived-1.2.18.tar.gz

2.解压安装:

tar -zxvf keepalived-1.2.18.tar.gz -C /usr/local/

3.下载插件openssl

yum install -y openssl openssl-devel(需要安装一个软件包)

4.开始编译keepalived

cd /usr/local/keepalived-1.2.18/ && ./configure --prefix=/usr/local/keepalived

5.make一下

make && make install

 

keepalived安装成Linux系统服务

(项目启动时候 服务也启动)

将keepalived安装成Linux系统服务,因为没有使用keepalived的默认安装路径(默认路径:/usr/local),安装完成之后,需要做一些修改工作:

首先创建文件夹,将keepalived配置文件进行复制:

mkdir /etc/keepalived

cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/

然后复制keepalived脚本文件:复制到 系统的文件里 会有意想不到的效果

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

cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/

ln -s /usr/local/sbin/keepalived /usr/sbin/

ln -s /usr/local/keepalived/sbin/keepalived /sbin/

可以设置开机启动:chkconfig keepalived on,到此我们安装完毕!

 

开启& 关闭:

   

service keepalived start

service keepalived stop

 

 

 

 

posted @ 2018-11-06 21:26  toov5  阅读(312)  评论(0编辑  收藏  举报