Search code examples
memcachedhaproxy

proxy Memcache_Servers has no server available


proxy Memcache_Servers has no server available, when I start the haproxy.service:

[root@ha-node1 log]# systemctl restart haproxy.service
 Message from syslogd@localhost at Aug  2 10:49:23 ...
 haproxy[81665]: proxy Memcache_Servers has no server available!

The configuration in my haproxy.cfg:

listen Memcache_Servers
  bind 45.117.40.168:11211
  balance roundrobin
  mode   tcp
  option  tcpka
  server ha-node1 ha-node1:11211 check inter 10s fastinter 2s downinter 2s rise 30 fall 3
  server ha-node2 ha-node2:11211 check inter 10s fastinter 2s downinter 2s rise 30 fall 3
  server ha-node3 ha-node3:11211 check inter 10s fastinter 2s downinter 2s rise 30 fall 3

Solution

  • At last, I found the ip in my hosts is like below:

    [root@ha-node1 sysconfig]# cat /etc/hosts
    127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
    192.168.8.101 ha-node1 ha-node1.aa.com
    192.168.8.102 ha-node2 ha-node2.aa.com
    192.168.8.103 ha-node3 ha-node3.aa.com
    45.117.40.168 ha-vhost devops.aa.com
    192.168.8.104 nfs-backend backend.aa.com
    

    But in my /etc/sysconfig/memcached, the ip is not the host ip before, so I changed to the ip in the hosts:

    enter image description here

    Now I restart the memcached and haproxy, it works normal now.