我已经通过 xinetd 使用 HAProxy设置了负载平衡 MySQL 从站。2 个负载均衡器共享一个由 Pacemaker 管理的虚拟 IP:
crm configure show:
node SVR120-27148.localdomain
node SVR255-53192.localdomain
primitive failover-ip ocf:heartbeat:IPaddr2 \
params ip="192.168.5.9" cidr_netmask="32" \
op monitor interval="5s" \
meta is-managed="true"
primitive haproxy ocf:heartbeat:haproxy \
params conffile="/etc/haproxy/haproxy.cfg" \
op monitor interval="30s" \
meta is-managed="true"
colocation haproxy-with-failover-ip inf: haproxy failover-ip
order haproxy-after-failover-ip inf: failover-ip haproxy
property $id="cib-bootstrap-options" \
dc-version="1.0.12-unknown" \
cluster-infrastructure="openais" \
no-quorum-policy="ignore" \
expected-quorum-votes="2" \
stonith-enabled="false" \
last-lrm-refresh="1342783084"
Run Code Online (Sandbox Code Playgroud)
/etc/haproxy/haproxy.cfg:
global
log 127.0.0.1 local1 debug …Run Code Online (Sandbox Code Playgroud)