Keepalived原理与实战精讲
来源:互联网 发布:尔雅网络课程手机登录 编辑:程序博客网 时间:2024/04/29 18:29
1
2
3
4
5
6
7
8
9
10
11
global_defs
{
notification_email
{
admin
@example
.com
}
notification_email_from admin
@example
.com
smtp_server
127.0
.
0.1
stmp_connect_timeout
30
router_id node1
}
1
2
3
4
5
notification_email
{
admin
@example
.com
admin
@ywlm
.net
}
1
2
3
4
5
notification_email
{
admin
@example
.com
admin
@ywlm
.net
}
1
2
3
4
5
6
7
8
9
10
11
vrrp_sync_group VG_1 {
group {
http
mysql
}
notify_master /path/to/to_master.sh
notify_backup /path_to/to_backup.sh
notify_fault
"/path/fault.sh VG_1"
notify /path/to/notify.sh
smtp_alert
}
1
2
3
4
group {
http
mysql
}
1
2
3
notify_master /path/to/to_master.sh表示当切换到master状态时要执行的脚本
notify_backup /path_to/to_backup.sh表示当切换到backup状态时要执行的脚本
notify_fault
"/path/fault.sh VG_1"
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
vrrp_instance http {
state MASTER
interface eth0
dont_track_primary
track_interface {
eth0
eth1
}
mcast_src_ip <IPADDR>
garp_master_delay 10
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
autp_pass 1234
}
virtual_ipaddress {
#<IPADDR>/<MASK> brd <IPADDR> dev <STRING> scope <SCOPT> label <LABEL>
192.168.200.17/24 dev eth1
192.168.200.18/24 dev eth2 label eth2:1
}
virtual_routes {
# src <IPADDR> [to] <IPADDR>/<MASK> via|gw <IPADDR> dev <STRING> scope <SCOPE> tab
src 192.168.100.1 to 192.168.109.0/24 via 192.168.200.254 dev eth1
192.168.110.0/24 via 192.168.200.254 dev eth1
192.168.111.0/24 dev eth2
192.168.112.0/24 via 192.168.100.254
}
nopreempt
preemtp_delay 300
debug
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
vrrp_script check_running {
script
"/usr/local/bin/check_running"
interval
10
weight
10
}
vrrp_instance http {
state BACKUP
smtp_alert
interface
eth0
virtual_router_id
101
priority
90
advert_int
3
authentication {
auth_type PASS
auth_pass whatever
}
virtual_ipaddress {
1.1
.
1.1
}
track_script {
check_running weight
20
}
}
1
2
3
4
5
vrrp_script check_running {
script
"/usr/local/bin/check_running"
interval
10
#脚本执行间隔
weight
10
#脚本结果导致的优先级变更
10
表示优先级+
10
-
10
则表示优先级-
10
}
1
2
3
4
track_script {
check_running
weight
20
}
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
global_defs
{
notification_email
{
admin
@example
.com
}
notification_email_from admin
@example
.com
smtp_server
127.0
.
0.1
stmp_connect_timeout
30
router_id node1
}
notification_email
{
admin
@example
.com
admin
@ywlm
.net
}
static_ipaddress
{
192.168
.
1.1
/
24
brd + dev eth0 scope global
192.168
.
1.2
/
24
brd + dev eth1 scope global
}
static_routes
{
src $SRC_IP to $DST_IP dev $SRC_DEVICE
src $SRC_IP to $DST_IP via $GW dev $SRC_DEVICE
}
vrrp_sync_group VG_1 {
group {
http
mysql
}
notify_master /path/to/to_master.sh
notify_backup /path_to/to_backup.sh
notify_fault
"/path/fault.sh VG_1"
notify /path/to/notify.sh
smtp_alert
}
group {
http
mysql
}
vrrp_script check_running {
script
"/usr/local/bin/check_running"
interval
10
weight
10
}
vrrp_instance http {
state MASTER
interface
eth0
dont_track_primary
track_interface {
eth0
eth1
}
mcast_src_ip <IPADDR>
garp_master_delay
10
virtual_router_id
51
priority
100
advert_int
1
authentication {
auth_type PASS
autp_pass
1234
}
virtual_ipaddress {
#<IPADDR>/<MASK> brd <IPADDR> dev <STRING> scope <SCOPT> label <LABEL>
192.168
.
200.17
/
24
dev eth1
192.168
.
200.18
/
24
dev eth2 label eth2:
1
}
virtual_routes {
# src <IPADDR> [to] <IPADDR>/<MASK> via|gw <IPADDR> dev <STRING> scope <SCOPE> tab
src
192.168
.
100.1
to
192.168
.
109.0
/
24
via
192.168
.
200.254
dev eth1
192.168
.
110.0
/
24
via
192.168
.
200.254
dev eth1
192.168
.
111.0
/
24
dev eth2
192.168
.
112.0
/
24
via
192.168
.
100.254
}
track_script {
check_running weight
20
}
nopreempt
preemtp_delay
300
debug
}
virtual_server_group <STRING> {
# VIP port
<IPADDR> <PORT>
<IPADDR> <PORT>
fwmark <INT>
}
virtual_server
192.168
.
1.2
80
{
delay_loop
3
lb_algo rr|wrr|lc|wlc|lblc|sh|dh
lb_kind NAT|DR|TUN
persistence_timeout
120
persistence_granularity <NETMASK>
protocol TCP
ha_suspend
virtualhost <string>
sorry_server <IPADDR> <PORT>
real_server <IPADDR> <PORT>
{
weight
1
inhibit_on_failure
notify_up <STRING> | <QUOTED-STRING>
notify_down <STRING> | <QUOTED-STRING>
#HTTP_GET方式
HTTP_GET | SSL_GET
{
url {
path /
digest <STRING>
status_code
200
}
connect_port
80
bindto <IPADD>
connect_timeout
3
nb_get_retry
3
delay_before_retry
2
}
}
}
0 0
- Keepalived原理与实战精讲
- Keepalived原理与实战精讲
- Keepalived原理与实战精讲
- Keepalived原理与实战精讲
- Keepalived原理与实战精讲
- Keepalived原理与实战精讲
- Keepalived原理与实战精讲
- Keepalived原理与实战精讲
- Keepalived原理与实战精讲
- Keepalived原理与实战精讲
- Keepalived原理与实战精讲
- Keepalived原理与实战精讲
- Keepalived原理与实战精讲
- Keepalived原理与实战精讲
- Keepalived原理与实战精讲
- Keepalived原理与实战精讲
- Keepalived原理与实战精讲
- Keepalived原理与实战精讲
- pragma once与#ifndef的作用有什么区别?
- 数据结构之---C语言实现斐波那契查找
- 深入浅出CChart 每日一课——快乐高四第十一课 不离不弃,利用CChartWnd实现多区域绘图
- Springmvc集成Shiro实现权限管理
- SSH之旅(一)——框架简介
- Keepalived原理与实战精讲
- TI Z-stack协议栈开发环境和工作流程
- 13 Roman to Integer
- hdoj2036
- BASE.CSS一份css初始化代码
- 没有为 COM 互操作注册程序集 请使用 regasm.exe /tlb 注册该程序集——解决办法
- mysql主从复制讲解
- 我的第一偏博客 怎么写啊 是这样吗???
- 一个Linux中用于监控的简易shell脚本