これが私たちの/etc/haproxy/haproxy.cfg
global
daemon
stats socket /var/lib/haproxy/stats
defaults
maxconn 10000
mode tcp
timeout connect 5s
timeout client 30s
timeout server 30s
listen galera
bind 192.168.55.19:3306
option httpchk
option tcplog
stick on dst
stick-table type ip size 2
timeout client 90m
timeout server 90m
server galera-1 192.168.55.31:3306 check inter 1s port 9200 on-marked-down shutdown-sessions
server galera-2 192.168.55.32:3306 check inter 1s port 9200 on-marked-down shutdown-sessions
server galera-3 192.168.55.33:3306 check inter 1s port 9200 on-marked-down shutdown-sessions
listen monitor
bind 127.0.0.01:9300
mode http
monitor-uri /status
stats enable
stats uri /admin
stats realm Haproxy\ Statistics
stats auth root:Eef7ye9Aeemu7Cei
stats refresh 5s
最初のノード galera-1 のみに接続したいと考えています。galera-2 と galera-3 はフェイルオーバーのみにする必要があります。
netstat を使用すると、かなり多くの接続が表示されます。なんで?トラブルシューティングの方法
# netstat -tupan | grep 192.168.55.32
tcp 0 0 192.168.55.34:59482 192.168.55.32:3306 ESTABLISHED 5045/haproxy
tcp 0 0 192.168.55.34:59466 192.168.55.32:3306 ESTABLISHED 5045/haproxy
tcp 0 0 192.168.55.34:54498 192.168.55.32:3306 ESTABLISHED 5045/haproxy
tcp 0 0 192.168.55.34:45546 192.168.55.32:3306 ESTABLISHED 5045/haproxy
tcp 0 0 192.168.55.34:54430 192.168.55.32:3306 ESTABLISHED 5045/haproxy
tcp 0 0 192.168.55.34:59502 192.168.55.32:3306 ESTABLISHED 5045/haproxy
tcp 0 0 192.168.55.34:59515 192.168.55.32:3306 ESTABLISHED 5045/haproxy
tcp 0 0 192.168.55.34:60039 192.168.55.32:3306 TIME_WAIT -
tcp 0 0 192.168.55.34:59454 192.168.55.32:3306 ESTABLISHED 5045/haproxy
tcp 0 0 192.168.55.34:59523 192.168.55.32:3306 ESTABLISHED 5045/haproxy
tcp 0 0 192.168.55.34:59518 192.168.55.32:3306 ESTABLISHED 5045/haproxy
tcp 0 0 192.168.55.34:59413 192.168.55.32:3306 ESTABLISHED 5045/haproxy