keepalived安装

配置主keepalived

客户端关闭防火墙与SELINUX

[root@master ~]# systemctl stop firewalld.service 
[root@master ~]# systemctl disable firewalld.service 
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@master ~]# setenforce 0
[root@master ~]# sed -ri 's/^(SELINUX=).*/\1disabled/g' /etc/selinux/config
[root@master ~]# 


客户端配置网络源

[root@master ~]# dnf -y install epel-release
[root@master ~]# dnf list all |grep keepalived
keepalived.x86_64                                                 2.1.5-6.el8                                            AppStream 
[root@master ~]# 

客户端安装keepalived

[root@master ~]# dnf -y install keepalived

客户端查看安装生成的文件

[root@master ~]# rpm -ql keepalived
/etc/keepalived     //配置目录
/etc/keepalived/keepalived.conf     //此为主配置文件
/etc/sysconfig/keepalived
/usr/bin/genhash
/usr/lib/systemd/system/keepalived.service      //此为服务控制文件
/usr/libexec/keepalived
/usr/sbin/keepalived
.....此处省略N行

用同样的方法在备服务器上安装keepalived
服务端关闭防火墙与SELINUX

[root@client ~]# systemctl stop firewalld.service 
[root@client ~]# systemctl disable firewalld.service 
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@client ~]# setenforce 0
[root@client ~]# sed -ri 's/^(SELINUX=).*/\1disabled/g' /etc/selinux/config
[root@client ~]# 

服务端配置网络源

[root@client ~]# dnf -y install epel-release
[root@client ~]# dnf list all |grep keepalived
keepalived.x86_64                                                 2.1.5-6.el8                                            AppStream        
[root@client ~]# 

服务端安装keepalived

[root@client ~]# dnf -y install keepalived

在主备机上分别安装nginx

在master上安装nginx

[root@master ~]# dnf -y install nginx
[root@master ~]# cd /usr/share/nginx/html/
[root@master html]# ls
404.html  50x.html  index.html  nginx-logo.png  poweredby.png
[root@master html]# echo 'master' > index.html 
[root@master html]# systemctl start nginx
[root@master html]# ss -antl
State  Recv-Q Send-Q  Local Address:Port   Peer Address:Port Process 
LISTEN 0      128           0.0.0.0:80          0.0.0.0:*            
LISTEN 0      128           0.0.0.0:22          0.0.0.0:*            
LISTEN 0      128              [::]:80           
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值