keepalived环境部署

一、软件安装

yum install -y keepalived

二、查询已安装的软件及路径

rpm -qc keepalived
/etc/keepalived/keepalived.conf
/etc/sysconfig/keepalived

三、配置抢占式高可用

抢占式主配置
vim /etc/keepalived/keepalived.conf
global_defs {
router_id keepalived01
}

vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 50
priority 150
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.0.0.3
}
}

抢占式备配置
vim /etc/keepalived/keepalived.conf
global_defs {
router_id keepalived02
}

vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id 50
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.0.0.3
}
}

四、配置非抢占式高可用

非抢占式主配置
vim /etc/keepalived/keepalived.conf
global_defs {
router_id keepalived01
}

vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id 50
priority 150
nopreempt
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.0.0.3
}
}

非抢占式备配置
vim /etc/keepalived/keepalived.conf
global_defs {
router_id keepalived02
}

vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id 50
priority 100
nopreempt
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.0.0.3
}
}

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容