1

I have one haproxy server (172.24.2.42) which redirects to one mariadb server with ip 172.24.2.13. Then I wished to replace this server with another mariadb server with ip 172.24.2.11 because this new server has more hard disk space. These servers are redhat.

I'm giving you haproxy.cfg

global
    log 127.0.0.1 local2
     maxconn 3000
     user haproxy
     group haproxy
     daemon

defaults
    log global
    mode http
    option  tcplog
    option  dontlognull
    option  redispatch
    timeout client 600000
    timeout connect 5000
    timeout server 600000
    retries 3
    maxconn 3000


listen db_cluster 0.0.0.0:1513
    mode tcp
    balance roundrobin
    option httpchk
    default-server port 9200 inter 2s downinter 5s rise 3 fall 2 slowstart 60s    maxconn 500 maxqueue 200
    server node-2 172.24.2.11:3306 check weight 200

When I restarted haproxy service. The following message was shown:

Message from syslogd@localhost at Mar  2 19:25:59 ...
 haproxy[17163]: proxy db_cluster has no server available!

Checking var/log/haproxy.log, it shows:

Mar  2 19:25:57 localhost haproxy[17158]: Server db_cluster/node-2 is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 0ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.

Even when I'm using putty on 172.24.2.42. I do:

mysql -uuser1 -p --host=172.24.2.13 ## it logins
mysql -uuser1 -p --host=172.24.2.11 ## it logins

Even I did:

nmap 172.24.2.11
PORT     STATE  SERVICE
22/tcp   open   ssh
3306/tcp open   mysql
4567/tcp open   tram

Port 3306 is enabled by firewall and getenforce shows disabled

So what I do in order it works I added to haproxy.cfg:

server node-4 172.24.2.13:3306 check weight 20

Then I restarted haproxy service and mariadb 172.24.2.13 was recognized by haproxy. Even though, that's not the idea because server 172.24.2.11 has to replace to server 172.24.2.13.

I don't know port 9200 has something to do.

What is missing?

user3637971
  • 155
  • 2
  • 11

1 Answers1

1

If you don't know what the default port 9200 is for then I'd recommend removing it - or change it to 3306 (which is what you want). Also, you have a typo in the default server line: lowstart 60s should be slowstart 60s.

The error you are getting implies a very fast failure i.e. no route to the server at all. Have you got multiple IPs on the load balancer? Could it be using the wrong one as the check source?

I would simplify the configuration, and try again.

  • Researching I saw Haproxy couldn't make health checks by port 9200 using percona clustercheck but I use mariadb 10.3.x. – user3637971 Mar 04 '19 at 00:34