Not the answer you need?
Register and ask your own question!

Haproxy config

GhanGhan EntrantCurrent User Role Supporter

Hello,

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?

Answers

  • sproninspronin Percona Staff Role

    Hello @Ghan ,

    Let's see. Please check that:

    1) Every MySQL node has /etc/xinet.d/mysqlchk script

    2) Every MySQL node has /usr/local/bin/clustercheck

    3) Every MySQL node has the following line in /etc/services

    mysqlchk        9200/tcp                # mysqlchk
    

    4) 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:

    1) HAProxy connects to port 9200 on every MySQL node

    2) This in turn invokes mysqlchk script, which invokes clustercheck script

    3) 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.

  • GhanGhan Entrant Current User Role Supporter

    Hi @spronin ,

    Thank you for your reply. Here is my Comments;

    1) Every MySQL node has /etc/xinet.d/mysqlchk script // Checked, not exist.

    2) Every MySQL node has /usr/local/bin/clustercheck // Checked, exist but not that directory.


    3) Every MySQL node has the following line in /etc/services // Checked, not exist.

    4) 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?

  • sproninspronin Percona Staff Role

    @Ghan

    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.

  • GhanGhan Entrant Current User Role Supporter

    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.

  • GhanGhan Entrant Current User Role Supporter

    Hello,

    Any news about finding scripts? Thx!

  • Evgeniy PatlanEvgeniy Patlan Percona Percona Staff Role

    Hey @Ghan

    you can find mysqlcheck script in /usr/bin

    [[email protected] ~]$ rpm -qf /usr/bin/mysqlcheck 

    percona-xtradb-cluster-client-8.0.20-11.3.el7.x86_64

Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.