Skip to content

MariaDBJones/mysqlchk-galera

 
 

Repository files navigation

mysqlchk for galera

Based on ClusterControl's mysqlchk script but built for Galera. It detects the Galera status on the cluster node as per below:

  • if wsrep_cluster_status is Primary,

  • return 'MySQL is running.'

  • else

  • return 'MySQL is *down*'

How to use

  1. Install HAProxy on the selected node.

  2. Grab the file galerachk.mysql from this repo and place it inb /usr/local/sbin/

  3. Update required informations :

MYSQL_HOST="localhost"
MYSQL_PORT="3306"
MYSQL_USERNAME='user'
MYSQL_PASSWORD='password'
  1. You are good to go. Now ensure in HAProxy you have 2 listeners (3307 for write, 3306 for read) and use option tcp-check & tcp-check expect to distinguish master/slave similar to example below:
listen  galera
        bind *:3306
        mode tcp
        #timeout client  10800s
        #timeout server  10800s
        balance leastconn
        option tcp-check
        tcp-check expect string is\ running.
        default-server port 9200 inter 2s downinter 5s rise 3 fall 2 # slowstart 60s maxconn 64 maxqueue 128 weight 100
        server node1 192.168.55.111:3306 check
        server node2 192.168.55.112:3306 check
        server node3 192.168.55.113:3306 check

maxscalechk

Based on ClusterControl's mysqlchk script but built for Maxscale. It detects the Maxscale status on the proxy node as per below:

  • if maxctrl list servers has return code 0,

  • return 'Maxscale is running.'

  • else

  • return 'Maxscale is *down*'

How to use

  1. Install HAProxy on the selected node.

  2. Grab the maxscalechk.service file from this repo and place it in /usr/local/sbin/ of the maxscale servers

  3. Update required informations :

MXS_USERNAME='user'
MXS_PASSWORD='password'
  1. Deploy the xinetd service on the maxscale machines as per below : add maxscalechk file to /etc/xinetd.d directory on maxscale servers

  2. link the new service and a port edit /etc/services and add the content of etc.services.maxscale on maxscale servers

  3. You are good to go.use option tcp-check & tcp-check expect :

listen  maxcale
        bind *:3306
        mode tcp
        #timeout client  10800s
        #timeout server  10800s
        balance leastconn
        option tcp-check
        tcp-check expect string is\ running.
        default-server port 9200 inter 1s downinter 5s rise 3 fall 2 # slowstart 60s maxconn 64 maxqueue 128 weight 100
        server node1 192.168.55.111:3306 check
        server node2 192.168.55.112:3306 check

About

HAproxy health check script for Galera and Maxscale csluter

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy