用法
Backend 配置域名
HAProxy 版本1.6开始支持域名解析功能
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
| resolvers mynameservers nameserver ns1 10.96.0.10:53 parse-resolv-conf resolve_retries 3 timeout resolve 1s timeout retry 1s hold other 10s hold refused 10s hold nx 10s hold timeout 10s hold valid 5s hold obsolete 10s
frontend keystone-admin_front mode http http-request del-header X-Forwarded-Proto option httplog option forwardfor http-request set-header X-Forwarded-Proto https if { ssl_fc } bind 0.0.0.0:5000 default_backend keystone-admin_back
backend keystone-admin_back mode http default-server init-addr none resolvers mynameservers server keystone-admin keystone-api.openstack.svc.cluster.local:5000 check inter 2000 rise 2 fall 5
|
请求重定向
1 2 3 4 5
| frontend demo mode http bind 0.0.0.0:9999 redirect location http://keystone.openstack.svc.cluster.local
|
日志管理
HAProxy将对应级别的log发送至指定日志服务器,默认为rsyslog日志服务
1 2
| global log 127.0.0.1 local2 info
|
- rsyslog配置文件:
/etc/rsyslog.conf
,修改后重启 rsyslog
服务
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| ...
$ModLoad imudp $UDPServerRun 514
$ModLoad imtcp $InputTCPServerRun 514 ...
*.emerg /var/log/messages ...
local2.* /var/log/haproxy.log ...
|
参考文档