fix3 多lb节点配置文件格式错误 Issue #286

pull/294/head
gjmzj 2018-08-15 09:36:01 +08:00
parent ced4f34aae
commit 91812bba9f
3 changed files with 12 additions and 3 deletions

View File

@ -12,7 +12,7 @@
192.168.1.1
192.168.1.2
# 负载均衡有且仅有两个节点,安装 haproxy+keepalived
# 负载均衡(目前已支持多于2节点一般2节点就够了) 安装 haproxy+keepalived
[lb]
192.168.1.1 LB_IF="eth0" LB_ROLE=backup # 注意根据实际使用网卡设置 LB_IF变量
192.168.1.2 LB_IF="eth0" LB_ROLE=master

View File

@ -2,9 +2,15 @@ global_defs {
router_id lb-backup
}
vrrp_script check-haproxy {
script "killall -0 haproxy"
interval 5
weight -60
}
vrrp_instance VI-kube-master {
state BACKUP
priority {{ 110 | random(1, 1) }}
priority {{ 119 | random(61, 1) }}
unicast_src_ip {{ inventory_hostname }}
unicast_peer {
{% for h in groups['lb'] %}{% if h != inventory_hostname %}
@ -15,6 +21,9 @@ vrrp_instance VI-kube-master {
interface {{ LB_IF }}
virtual_router_id {{ ROUTER_ID }}
advert_int 3
track_script {
check-haproxy
}
virtual_ipaddress {
{{ MASTER_IP }}
}

View File

@ -5,7 +5,7 @@ global_defs {
vrrp_script check-haproxy {
script "killall -0 haproxy"
interval 5
weight -30
weight -60
}
vrrp_instance VI-kube-master {