I have a problem with the connection of my vm where haproxy is running, and the clusters. Let me explain the issue. I’ve setup 2 galera cluster machine with MariaDB (IPs 192.168.0.1 and 192.168.0.2) and a haproxy host (IP 192.168.0.3). I’ve followed almost all tutorial I’ve found in internet but I have always the same problem: I can’t connect and perform any query from the haproxy
Actual state:
galera work fine
root@db1:# mysql -u root -pPASSWORD -e 'SELECT VARIABLE_VALUE as "cluster size" FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME="wsrep_cluster_size"' +--------------+ | cluster size | +--------------+ | 2 | +--------------+
haproxy is well installed, and a user with all privileges is present in the database. The config file for haproxy is the following:
global log 127.0.0.1 local0 log 127.0.0.1 local1 notice maxconn 1024 user haproxy group haproxy daemon stats socket /var/lib/haproxy/stats.sock mode 600 level admin stats timeout 2m defaults log global mode http option tcplog option dontlognull retries 3 option redispatch maxconn 1024 timeout connect 5000ms timeout client 50000ms timeout server 50000ms listen haproxy-monitoring bind *:80 mode http stats enable stats show-legends stats refresh 5s stats uri / stats realm Statistics stats auth User:Password stats admin if TRUE frontend lb1db bind *:3306 default_backend galera-cluster backend galera-cluster balance roundrobin server db1 192.168.0.1:3306 check weight 1 server db2 192.168.0.2:3306 check weight 1
The my.cnf is the following:
[galera] wsrep_on=ON wsrep_provider=/usr/lib/galera/libgalera_smm.so wsrep_cluster_address=gcomm://192.168.0.94,192.168.0.93 wsrep_node_addres=192.168.0.1. #vm1 IP; in the other config is present the vm2 IP wsrep_node_name=db1 binlog_format=row default_storage_engine=InnoDB innodb_autoinc_lock_mode=2 wsrep_cluster_name="Cluster_name" wsrep_sst_method=rsync bind-address=192.168.0.1 #vm1 IP; in the other config is present the vm2 IP
When I try to execute a query in the haproxy I have the following result:
mysql -u root -pPASSWORD --host=192.168.0.3 --port=3306
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.0.3' (111 "Connection refused")
As I wrote I followed several tutorial and the problem is always the same. Can anyone help me?