I'm following this article to configure HAProxy to balance with roundrobin between 3 MySQL servers (db1, db2, db3) in a MariaDB Galera cluster (working perfectly).
However I have a problem. In the tutorial there's a "Testing Load Balancing and Failover" area, in which I must execute the command
mysql -h 127.0.0.1 -u haproxy_root -p -e "show variables like 'server_id'" to see the same result along with the server name. Executing the same command more than once will show the roundrobin jumping between
db2 and viceversa... it never pass to
db3. I'm reading everywhere and roundrobin should jump between all the servers, but in my case it just work between db1 and db2, why not in db3?
Check my HAProxy configuration:
global log 127.0.0.1 local0 notice user haproxy group haproxy defaults log global retries 2 timeout connect 3000 timeout server 5000 timeout client 5000 listen mysql-cluster bind 0.0.0.0:3306 mode tcp option mysql-check user haproxy_check balance roundrobin server db1 172.28.109.10:3306 check server db2 172.28.109.11:3306 check server db3 172.28.109.12:3306 check listen 127.0.0.1:8080 mode http stats enable stats uri / stats realm Strictly\ Private stats auth monitor_user:password
Those 3 servers are properly declared in my MariaDB Galera Cluster configuration file, and they share behave perfectly in between. Check part of it here:
wsrep_provider=/usr/lib64/galera/libgalera_smm.so wsrep_cluster_address="gcomm://188.8.131.52, 184.108.40.206, 220.127.116.11" wsrep_cluster_name='galera_cluster' wsrep_node_address='18.104.22.168' wsrep_node_name='db1' wsrep_sst_method=rsync wsrep_sst_auth="user:password"
What am I missing? Please help me.
Thanks in advance.