配合之前建立 MariaDB/MySQL 安裝 Galera Cluster ,需要使用Haproxy來做負載平衡。
global
log 127.0.0.1 local0
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
daemon
defaults
mode http
log global
option httplog
option dontlognull
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 500
#管理頁面
listen stats
bind 0.0.0.0:8181
stats enable
stats hide-version
stats uri /admin
stats auth admin:admin
stats admin if TRUE
stats refresh 30s
#MariaDB/MySQL
frontend MySQL
bind *:3306
mode tcp
option tcplog
capture request header Host len 64
capture request header User-Agent len 128
capture request header X-Forwarded-For len 100
capture request header Referer len 200
capture response header Server len 40
capture response header Server-ID len 40
log-format "%ci:%cp [%t] %ft %b/%s %Tw/%Tc/%Tt %B %ts %ac/%fc/%bc/%sc/%rc %sq/%bq"
default_backend MySQL
mode tcp
balance leastconn
server db01 192.168.11.101:3306
server db02 192.168.11.102:3306
參考資料
Percona XtraDB Cluster 搭配 HAProxy
沒有留言:
張貼留言
注意:只有此網誌的成員可以留言。