RedHat系统安装Keepalived

时间:2025-03-31 08:39:12

目录

1、系统要求

1.1、RedHat版本

2、软件要求

2.1、Keepalived版本

3、安装步骤

3.1、在线

3.1.1、安装

3.1.2、配置

3.1.3、启动

3.1.4、停止

3.2、手动

3.2.1、从官网下载keepalived安装包

3.2.2、上传或下载keepalived

3.2.3、解压安装

3.2.4、将keepalived安装成Linux系统服务

3.2.5、设置keepalived服务开机启动

3.2.6、修改Keepalived配置文件

3.2.7、启动Keepalived

3.2.8、停止Keepalived

4、应用

4.1、Keepalived + Nginx

4.2、其他


1、系统要求

1.1、RedHat版本

系统版本:7.6

备注:系统版本>=7.6

2、软件要求

2.1、Keepalived版本

软件版本:2.2.8

备注:软件版本>=2.2.8

3、安装步骤

3.1、在线

3.1.1、安装

yum install keepalived --y

3.1.2、配置

vi /etc/keepalived/ 

备注:可根据需要进行配置

3.1.3、启动

systemctl start

3.1.4、停止

systemctl stop

3.2、手动

3.2.1、从官网下载keepalived安装包

Keepalived for Linux

3.2.2、上传或下载keepalived

上传或下载keepalived(keepalived-2.2.)到/usr/local/soft目录

3.2.3、解压安装

cd /usr/local/soft
tar -zxvf keepalived-2.2.
cd keepalived-2.2.8
./configure --prefix=/usr/local/keepalived
make && make install

3.2.4、将keepalived安装成Linux系统服务

mkdir /etc/keepalived
cp /usr/local/keepalived/etc/keepalived/ /etc/keepalived/
cp /usr/local/keepalived/etc///keepalived /etc//
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/

3.2.5、设置keepalived服务开机启动

chkconfig keepalived on

3.2.6、修改Keepalived配置文件

vi /etc/keepalived/ 

备注:可根据需要进行配置

3.2.7、启动Keepalived

service keepalived start

3.2.8、停止Keepalived

service keepalived stop

4、应用

4.1、Keepalived + Nginx

如:使用Keepalived + Nginx实现高可用Web负载均衡,具体配置略。

4.2、其他

略。