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?