centos7安装keepalived
发表于:2025-12-02 作者:千家信息网编辑
千家信息网最后更新 2025年12月02日,一、基础环境系统版本nginx版本keepalived版本ip作用CentOS Linux release 7.5.1804 (Core)nginx/1.16.1keepalived-2.0.1810
千家信息网最后更新 2025年12月02日centos7安装keepalived
一、基础环境
| 系统版本 | nginx版本 | keepalived版本 | ip | 作用 |
|---|---|---|---|---|
| CentOS Linux release 7.5.1804 (Core) | nginx/1.16.1 | keepalived-2.0.18 | 10.1.1.31 | master |
| CentOS Linux release 7.5.1804 (Core) | nginx/1.16.1 | keepalived-2.0.18 | 10.1.1.32 | slave |
VIP 10.1.1.111
二、安裝nginx
安裝nignx
yum install nginx -y修改nginx配置文件
master
echo 'this is master 31' > /usr/share/nginx/html/index.htmlslave
echo 'this is slave 32' > /usr/share/nginx/html/index.html
启动nginx
systemctl start nginx测试nginx启动
curl localhostthis is master
三、安装keepalived
1、 创建依赖环境
yum -y install openssl-devel gcc gcc-c++mkdir /etc/keepalivedwget https://www.keepalived.org/software/keepalived-2.0.18.tar.gz2、安装keepalived
tar -zxvf keepalived-2.0.18.tar.gzmv keepalived-2.0.18 /usr/local/keepalivedcd /usr/local/keepalived./configure && make && make install3、创建启动文件
cp -a /usr/local/etc/keepalived /etc/init.d/cp -a /usr/local/etc/sysconfig/keepalived /etc/sysconfig/cp -a /usr/local/sbin/keepalived /usr/sbin/4、创建配置文件
master
cat > /etc/keepalived/keepalived.conf << EOF! Configuration File for keepalivedglobal_defs { router_id 31} vrrp_instance VI_1 { state MASTER interface ens33 virtual_router_id 3 mcast_src_ip 10.1.1.132 priority 200 advert_int 1 authentication { auth_type PASS auth_pass 123456 } virtual_ipaddress { 10.1.1.111/24 }}EOFslave
cat > /etc/keepalived/keepalived.conf << EOF! Configuration File for keepalivedglobal_defs { router_id 32} vrrp_instance VI_1 { state BACKUP interface ens33 virtual_router_id 3 mcast_src_ip 10.1.1.132 priority 90 advert_int 1 authentication { auth_type PASS auth_pass 123456 } virtual_ipaddress { 10.1.1.111/24 }}EOF
5、启动keepalived
systemctl start keepalivedsystemctl enable keepalived四、测试
1、在两台服务器上测试
master
$ curl localhostthis is masterroot@centos7[14:46:07]:~$ curl 10.1.1.111this is masterroot@centos7[15:03:29]:~slave
$ curl localhostthis is slaveroot@centos7[15:03:59]:/etc/keepalived$ curl 10.1.1.111this is master
2、关闭master的keepalived模仿down机
master关闭keepalived
$ systemctl stop keepalived- 在slave上面进行测试
$ curl localhostthis is slaveroot@centos7[15:10:29]:/etc/keepalived$ curl 10.1.1.111this is slave到此keepalived完成
测试
文件
版本
环境
配置
作用
基础
服务器
系统
服务
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
网络安全制度的文章
网络安全平安建设
数据库备份导入数据库
站群服务器如何提升
微信服务器的容量
数据库的管理方法
sql数据库假死现象
学编程软件开发在哪学比较好
数据库迁移不停机方案
服务器实时监控
国家网络安全治安法
oercel数据库端口
连云港app软件开发哪家好
达州市网络安全局
昆明非比网络技术有限公司规模
没有域名可以搭建游戏服务器吗
如何从数据库中添加文件夹
集成化软件开发ipd
数据库锁与对象锁
银行网络安全培训心得
深圳安胜网络技术
从数据库到实体类
泰安联想服务器哪家是专业做的
服务器上的安全数据没有
詹天佑笔记软件开发
网络安全操作维护中心
绝地求生端游显示服务器满
临沂服务器管理系统公司
西贝服务器
网络安全十大意识