Skip to content

Commit

Permalink
修复CentOS 下haproxy 工作目录
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgao1983 committed Dec 15, 2017
1 parent 5c2a151 commit a37ce50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/01-创建CA证书和环境配置.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ vrrp_instance VI-kube-master {
```
+ vrrp_script 定义了监测haproxy进程的脚本,利用shell 脚本`killall -0 haproxy` 进行检测进程是否存活,如果进程不存在,根据`weight -30`设置将主节点优先级降低30,这样原先备节点将变成主节点。
+ vrrp_instance 定义了vrrp组,包括优先级、使用端口、router_id、心跳频率、检测脚本、虚拟地址VIP等
+ 特别注意 `virtual_router_id` 标识了一个 VRRP组,在同网段下必须唯一,否则出现 `Keepalived_vrrp: bogus VRRP packet received on eth0 !!!`类似报错

#### 配置keepalived备节点 [keepalived-backup.conf.j2](../roles/lb/templates/keepalived-backup.conf.j2)
``` bash
Expand All @@ -224,7 +225,7 @@ vrrp_instance VI-kube-master {
}
}
```
+ 备节点的配置类似主节点,除了优先级和检测脚本
+ 备节点的配置类似主节点,除了优先级和检测脚本,其他如 `virtual_router_id` `advert_int` `virtual_ipaddress`必须与主节点一致

### 启动 keepalived 和 haproxy 后验证

Expand Down
3 changes: 3 additions & 0 deletions roles/lb/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
- name: 创建haproxy配置目录
file: name=/etc/haproxy state=directory

- name: 创建haproxy工作目录
file: name=/run/haproxy state=directory

- name: 配置 haproxy
template: src=haproxy.cfg.j2 dest=/etc/haproxy/haproxy.cfg

Expand Down

0 comments on commit a37ce50

Please sign in to comment.