18 releases (6 stable)

1.1.2 Mar 2, 2022
1.0.1 Nov 4, 2021
1.0.0 Jun 1, 2021
0.4.3 Feb 13, 2021
0.1.0 Dec 3, 2018

#698 in Database interfaces

39 downloads per month


205 lines


HTTP status codes for galera cluster

crates.io build


This helps to check the galera cluster using HAProxy - option httpchk which queries the galera node and gets its current state from: SHOW STATUS LIKE 'wsrep_local_state';

if wsrep_local_state == 4 it will return HTTP 200 OK, otherwise HTTP 503 Service Unavailable

The posible values for wsrep_local_state are:

Num Comment Description
1 Joining Node is joining the cluster
2 Donor/Desynced Node is the donor to the node joining the cluster
3 Joined Node has joined the cluster
4 Synced Node is synced with the cluster

HAProxy example

backend galera
    mode tcp
    option httpchk
    default-server check port 9200
    server node0
    server node1
    server node2


You need to run httpwsrep in each galera node preferably using a supervisor, for example if using immortal you could create /usr/local/etc/immortal/httpwsrep.yml with something like this:

cmd: /path/to/httpwsrep
    DSN: mysql://haproxy@tcp(
    file: /var/log/httpwsrep.log

a valid mysql user needs to be created, in this case the user is haproxy

By default port 9200 is used but if required can change it using option --port


You can use Prometheus and query the endpoint: /metrics


~634K SLoC