前言
在生产环境当中,内网与公网都是独立分开的,因此内网和公网不用同步漂移,例如:Keepalived+LVS-DR、Keepalived+Nginx、Keepalived+HAProxy 都无需同步漂移。
注:Keepalived+LVS-NAT模式除外。
架构图
1 | +------+ +--------+ |
keepalived配置
Master配置1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52global_defs {
notification_email {
root@localhost
}
notification_email_from ka@localhost
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id ka101
vrrp_mcast_group4 224.0.0.111
}
vrrp_sync_group VG_1 {
group {
Extranet_1
Intranet_1
}
}
vrrp_instance Extranet_1 {
state MASTER
interface eth0
virtual_router_id 171
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass sunday0
}
virtual_ipaddress {
172.16.20.91/16
}
notify_master "/etc/keepalived/notify.sh master"
notify_backup "/etc/keepalived/notify.sh backup"
notify_fault "/etc/keepalived/notify.sh fault"
}
vrrp_instance Intranet_1 {
state MASTER
interface eth1
virtual_router_id 191
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass sunday1
}
virtual_ipaddress {
192.168.10.91
}
notify_master "/etc/keepalived/notify.sh master"
notify_backup "/etc/keepalived/notify.sh backup"
notify_fault "/etc/keepalived/notify.sh fault"
}
Backup配置1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52global_defs {
notification_email {
root@localhost
}
notification_email_from ka@localhost
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id ka102
vrrp_mcast_group4 224.0.0.111
}
vrrp_sync_group VG_1 {
group {
Extranet_1
Intranet_1
}
}
vrrp_instance Extranet_1 {
state BACKUP
interface eth0
virtual_router_id 171
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass sunday0
}
virtual_ipaddress {
172.16.20.91/16
}
notify_master "/etc/keepalived/notify.sh master"
notify_backup "/etc/keepalived/notify.sh backup"
notify_fault "/etc/keepalived/notify.sh fault"
}
vrrp_instance Intranet_1 {
state BACKUP
interface eth1
virtual_router_id 191
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass sunday1
}
virtual_ipaddress {
192.168.10.91
}
notify_master "/etc/keepalived/notify.sh master"
notify_backup "/etc/keepalived/notify.sh backup"
notify_fault "/etc/keepalived/notify.sh fault"
}
1 | Aug 13 18:31:38 node1 Keepalived_vrrp[1133]: Opening file '/etc/keepalived/keepalived.conf'. |
https://serverfault.com/questions/918642/start-keepalived-without-ip-on-interface
https://renwole.com/archives/1097