首页 > 其他分享 >keepalived双主架构

keepalived双主架构

时间:2022-10-24 11:41:12浏览次数:45  
标签:node 架构 keepalived etc master notify conf 双主

一 环境规划

节点

IP

功能

VIP

node-01

192.168.174.120

keepalived master/slave

192.168.174.20

node-02

192.168.174.121

keepalived slave/master

192.168.174.21

二 设置node-01节点

2.1 查看node-01节点配置

root@node-01:~# cat /etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs {

notification_email {

[email protected]

}

notification_email_from [email protected]

smtp_server 127.0.0.1

smtp_connect_timeout 30

router_id node-01

vrrp_skip_check_adv_addr

vrrp_strict

vrrp_garp_interval 0

vrrp_gna_interval 0

}

include /etc/keepalived/conf.d/*.conf

2.2 创建配置文件路径

root@node-01:~# mkdir -pv /etc/keepalived/conf.d
mkdir: created directory '/etc/keepalived/conf.d'

2.3 配置实例master.conf

root@node-01:~# cat /etc/keepalived/conf.d/master.conf 
vrrp_instance VI_1 {
state MASTER
interface ens33
virtual_router_id 101
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.174.20
}
notify_master "/etc/keepalived/notify.sh master"
notify_backup "/etc/keepalived/notify.sh backup"
notify_fault "/etc/keepalived/notify.sh fault"
}

2.4 设置实例slave.conf

root@node-01:~# cat /etc/keepalived/conf.d/slave.conf 
vrrp_instance VI_2 {
state BACKUP
interface ens33
virtual_router_id 102
priority 80
advert_int 1
authentication {
auth_type PASS
auth_pass 123456
}
virtual_ipaddress {
192.168.174.21
}
notify_master "/etc/keepalived/notify.sh master"
notify_backup "/etc/keepalived/notify.sh backup"
notify_fault "/etc/keepalived/notify.sh fault"
}

2.5 启动keepalived服务

root@node-01:~# systemctl start keepalived

21.6 查看node-01节点VIP

root@node-01:~# hostname -I
192.168.174.120 192.168.174.20 192.168.174.21

三 设置node-02节点

3.1 查看node-01节点配置

root@node-02:~# cat /etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs {

notification_email {

[email protected]

}

notification_email_from [email protected]

smtp_server 127.0.0.1

smtp_connect_timeout 30

router_id node-01

vrrp_skip_check_adv_addr

vrrp_strict

vrrp_garp_interval 0

vrrp_gna_interval 0

}

include /etc/keepalived/conf.d/*.conf

3.2 创建配置文件路径

root@node-02:~# mkdir -pv /etc/keepalived/conf.d
mkdir: created directory '/etc/keepalived/conf.d'

3.3 配置实例master.conf

root@node-02:~# cat /etc/keepalived/conf.d/master.conf 
vrrp_instance VI_2 {
state BACKUP
interface ens33
virtual_router_id 102
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 123456
}
virtual_ipaddress {
192.168.174.21
}
notify_master "/etc/keepalived/notify.sh master"
notify_backup "/etc/keepalived/notify.sh backup"
notify_fault "/etc/keepalived/notify.sh fault"
}

3.4 设置实例slave.conf

root@node-02:~# cat /etc/keepalived/conf.d/slave.conf 
vrrp_instance VI_1 {
state BACKUP
interface ens33
virtual_router_id 101
priority 80
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.174.20
}
notify_master "/etc/keepalived/notify.sh master"
notify_backup "/etc/keepalived/notify.sh backup"
notify_fault "/etc/keepalived/notify.sh fault"
}

3.5 启动keepalived服务

root@node-02:~# systemctl start keepalived

3.6 查看node-02节点VIP

root@node-02:~# hostname -I
192.168.174.121 192.168.174.21

3.7 查看node-01节点VIP

root@node-01:~# hostname -I
192.168.174.120 192.168.174.20



标签:node,架构,keepalived,etc,master,notify,conf,双主
From: https://blog.51cto.com/u_4028786/5789197

相关文章

  • keepalived主从架构
    一环境规划节点IP功能VIPnode-01192.168.174.120keepalivedmaster192.168.174.20node-02192.168.174.121keepalivedslave192.168.174.20二抢占模式抢占模式,即当高优先级......
  • ubuntu20.04部署keepalived
    一环境准备1.1设置时间同步root@node-01:~#apt-yinstallchronyroot@node-01:~#systemctlenablechrony二在线安装2.1查看keepalived软件版本root@node-01:~#apt-......
  • 概念介绍_软件架构和概念介绍_资源分类
    概念介绍_软件架构:web概念概述Javaweb:使用iava语言开发基于互联网的项目软件架构∶1.c/s:client/server客户端/服务器端在用户本地有一个客户端程序,在远程有一个......
  • 浅谈软件架构师的素质与职责
    最近开始学习如何成为一名合格的架构师。首先参照别人的观点,在结合自己的实际经验,写出自己对如何成为一名架构师的理解,希望大家热心于与援手,能够指点......
  • Thanos 架构剖析(五)历史数据怎么办
    ThanosCompactor组件是针对Prometheus2.x存储引擎的生成的数据来进行压缩和降准的组件。对于数据压缩来说,并行操作是存在一定安全风险的,所以ThanosCompactor组件......
  • Thanos 架构剖析(六)告警规则如何管理
    ThanosRule组件通过thanosrule命令来启动,通过重复查询Query来评估告警是否触发,如果有多个Query,那么会通过轮询来保持平衡。默认情况下,Rule评估结果以Prometheu......
  • Thanos 架构剖析(三)如何选择 Sidecar 和 Receiver
    Sidecar和Receiver是Thanos和Prometheus进行数据交互的两个核心组件,我们来看看这两个组件有什么区别,分别都是怎么使用的。SidecarThanosSidecar组件需要和Porm......
  • Thanos 架构剖析(四)数据存储和运维工具
    ThanosStore主要提供查询历史数据功能,当Querier组件调用Stroe接口,Stroe再通过对象存储接口获取数据,并将存储数据转换成Querier所需的数据格式。Thanos数据存储Thanos......
  • VMware Horizon 8 2209 - 虚拟桌面基础架构 (VDI) 和应用软件
    请访问原文链接:https://sysin.org/blog/vmware-horizon-8-2209/,查看最新版。原创作品,转载请保留出处。作者主页:www.sysin.orgVersion2209DocumentationRelea......
  • 升级Xcode14之后如何打出带有armv7架构的SDK包
    Xcode14以前是默认armv7和arm64的,升级Xcode之后就被苹果这厮移除了,所以答案是Xcode14是打不出来armv7的包的,因为某些资本家的理念:宁可兼容到每一个古董机型,也不......