I am trying to configure Haproxy in front of my xtradb cluster. I need to enable scripts that is checking which node is active&runnig. I followed https://www.percona.com/doc/percona-xtradb-cluster/8.0/howtos/haproxy.html this article but could not manage to use clustercheck . Does anybody know how it needs to be run?
Every MySQL node has the following line in /etc/services
mysqlchk 9200/tcp # mysqlchk
HAProxy has something like (key here is check port 9200):
option httpchk
server db01 10.4.29.100:3306 check port 9200 inter 12000 rise 3 fall 3
server db02 10.4.29.99:3306 check port 9200 inter 12000 rise 3 fall 3
server db03 10.4.29.98:3306 check port 9200 inter 12000 rise 3 fall 3
The way it works is the following:
HAProxy connects to port 9200 on every MySQL node
This in turn invokes mysqlchk script, which invokes clustercheck script
If clustercheck returns 200 - all good, 503 - node is not healthy. HAproxy makes the decision based on these codes.
If something is not working as expected, try debugging the problem from the bottom. Check if clustercheck returns correct codes and works properly. Then try if you can invoke mysqlchk locally and through the network.