diff options
Diffstat (limited to 'parcels/roles/services/galaxy-gateway-keepalive/templates/app-keepalived.conf.master.j2')
| -rw-r--r-- | parcels/roles/services/galaxy-gateway-keepalive/templates/app-keepalived.conf.master.j2 | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/parcels/roles/services/galaxy-gateway-keepalive/templates/app-keepalived.conf.master.j2 b/parcels/roles/services/galaxy-gateway-keepalive/templates/app-keepalived.conf.master.j2 new file mode 100644 index 0000000..20c47da --- /dev/null +++ b/parcels/roles/services/galaxy-gateway-keepalive/templates/app-keepalived.conf.master.j2 @@ -0,0 +1,48 @@ +! Configuration File for keepalived + + +#其实配置文件中主要要修改的选项没有很多,以下几个参数要注意 +#interface 网卡名称 +#priority 150 #优先级,同一个实例下,MASTER高于BACKUP +####下面这两项已经修改好了,建议不要修改了 +#route_id XXX #MASTER和BACKUP不同 +#virtual_router_id 51 #同一个实例下,MASTER和BACKUP相同 + +#监控服务.NGINX mysql等 +vrrp_script chk_gateway { + script "/etc/keepalived/check_gateway.sh" + #每2s检查一次 + interval 2 + #每次检查-20 + weight -20 +} + +#VRRP实例定义块 +vrrp_instance VI_1 { +#状态只有MASTER和BACKUP两种,并且要大写,MASTER为工作状态,BACKUP是备用状态。 +state MASTER +#网卡名称 +interface {{ gateway_keepalive_interface }} +#虚拟路由标识,同一个vrrp_instance的MASTER和BACKUP的vitrual_router_id 是一致的。 +virtual_router_id {{ gateway_keepalive_router_id }} +#优先级,同一个vrrp_instance的MASTER优先级必须比BACKUP高。 +priority 150 +#MASTER 与BACKUP 负载均衡器之间同步检查的时间间隔,单位为秒。 +advert_int 1 +authentication { +#验证authentication。包含验证类型和验证密码。类型主要有PASS、AH 两种,通常使用的类型为PASS +auth_type PASS +#据说AH 使用时有问题。验证密码为明文,同一vrrp 实例MASTER 与BACKUP 使用相同的密码才能正常通信 +auth_pass 1111 +} +#触发的脚本 +track_script { +#检测脚本,上面配置的 + chk_gateway +} +virtual_ipaddress { +#虚拟ip地址,可以有多个地址,每个地址占一行,不需要子网掩码 + {{ gateway_keepalive_host }} +} +} + |
