centos7系统keepalvie高可用(抢占式)
2021/4/9 7:30:14
本文主要是介绍centos7系统keepalvie高可用(抢占式),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
一、基础环境
master: 192.168.203.128 slave: 192.168.203.129 VIP 192.168.203.130
二、安装keepalive
1、 创建依赖环境
yum -y install openssl-devel gcc gcc-c++ mkdir /etc/keepalived wget https://www.keepalived.org/software/keepalived-2.0.18.tar.gz
2、安装keepalived
tar -zxvf keepalived-2.0.18.tar.gz mv keepalived-2.0.18 /usr/local/keepalived cd /usr/local/keepalived ./configure && make && make install
3、创建启动文件
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、创建配置文件
1 master
vim /etc/keepalived/keepalived.conf
global_defs { router_id internal_control } vrrp_instance VI_1 { state MASTER interface ens33 virtual_router_id 3 priority 200 advert_int 1 authentication { auth_type PASS auth_pass 123456 } virtual_ipaddress { 192.168.203.130/24 } }
2 slave
vim /etc/keepalived/keepalived.conf
global_defs { router_id internal_control } vrrp_instance VI_1 { state BACKUP interface ens33 virtual_router_id 3 priority 90 advert_int 1 authentication { auth_type PASS auth_pass 123456 } virtual_ipaddress { 192.168.203.130/24 } }
5、启动keepalived(2台机器)
systemctl start keepalived systemctl enable keepalived
查看maser上已经有vip地址了
三、测试
1 master关闭keepalived
systemctl stop keepalived
2 salve查看vip地址
这篇关于centos7系统keepalvie高可用(抢占式)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-27Rocket消息队列资料:新手入门指南
- 2024-11-27rocket消息队资料详解与入门指南
- 2024-11-27RocketMQ底层原理资料详解入门教程
- 2024-11-27RocketMQ项目开发资料:新手入门教程
- 2024-11-27RocketMQ项目开发资料详解
- 2024-11-27RocketMQ消息中间件资料入门教程
- 2024-11-27初学者指南:深入了解RocketMQ源码资料
- 2024-11-27Rocket消息队列学习入门指南
- 2024-11-26Rocket消息中间件教程:新手入门详解
- 2024-11-26RocketMQ项目开发教程:新手入门指南