keepalived安装

Posted liuys635

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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

技术图片

 

以上是关于keepalived安装的主要内容,如果未能解决你的问题,请参考以下文章

Keepalived概述和安装

Keepalived详解

keepalived安装与配置

【keepalived】keepalived 容器化安装

Keepalived安装和主要配置文件详解

keepalived编译安装