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?
Hello @Ghan ,
Let’s see. Please check that:
Every MySQL node has /etc/xinet.d/mysqlchk script
Every MySQL node has /usr/local/bin/clustercheck
Every MySQL node has the following line in /etc/services
mysqlchk 9200/tcp # mysqlchk
- HAProxy has something like (key here is check port 9200):
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.
Hi @spronin ,
Thank you for your reply. Here is my Comments;
Every MySQL node has /etc/xinet.d/mysqlchk script // Checked, not exist.
Every MySQL node has /usr/local/bin/clustercheck // Checked, exist but not that directory.
- Every MySQL node has the following line in /etc/services // Checked, not exist.
- HAProxy has something like (key here is check port 9200) // This is done.
I got how it is need to be work, Like Patroni Allright, so how can i find missing parts?
Have you installed XtraDB Cluster from Percona’s distribution? These scripts should come along with the distribution.
/etc/services file is not populated automatically and you need to change it manually on every MySQL node.
Correct, i used “yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm -y” and “percona-release setup pxc80” . Then installed xtradb on nodes.
Ok, i will add above line to /etc/services.
Any news about finding scripts? Thx!
you can find mysqlcheck script in /usr/bin
[vagrant@localhost ~]$ rpm -qf /usr/bin/mysqlcheck