0

We have one galera cluster, mariadb version 10.3 and haproxy.

We want the users to connect like this client->haproxy->galera_cluster. The user we create in the database we allow the IP to the client. For http we found that you can use send-proxy or X-Origin IP in the header.

We want to, to the same with galera cluster, TCP protocol.

We add this in mariadb config file: "proxy_protocol_networks = haproxy_server/32"

We use ubuntu 16.04 and haproxy 1.6.

haproxy config file

 backend galera
 bind 0.0.0.0:3306
 balance leastconn
 mode tcp
 option tcpka
 option forwardfor
 option log-health-checks
 retries                   3
 timeout queue             1m
 timeout connect           15s
 timeout client            50m
 timeout server            50m
 timeout check             10s
 option mysql-check user haproxy
 server node1 IP_Cluster_1:3306 check send-proxy 

Any ideas how we can to that.

Thanks :)

0

MariaDB supports the Proxy Protocol beginning in 10.3, so send-proxy should work.

But first, you need to configure proxy-protocol-networks with the subnet of the proxy (not of the clients).

https://mariadb.com/kb/en/library/proxy-protocol-support/

  • Hello, Thanks for the reply. In the my.cnf we have the configure of the IP proxy server. For the haproxy config we try the send-proxy and send-proxy-v2 , nothing happens. We can telnet the port but when we try to connect, it asks us for the password but not any reply. Also not error. I add now the haproxy config file – pioupiou Jun 14 '18 at 11:35
0

The problem it was in the haproxy config file. This is the correct config file of haproxy.

frontend mysqld_listen
    bind *:3306
    mode tcp
    log global
    option  dontlognull
    option tcplog
    use_backend galera

backend galera
    balance leastconn
    mode tcp
    option tcpka
    option tcplog
    option log-health-checks
    retries                   3
    option mysql-check user haproxy
    server node1 IP_1:3306 check weight 1 send-proxy-v2 

Thanks a lot :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.