memcached.service是活动的,但在haproxy网页中它们已关闭

时间:2017-08-01 17:09:18

标签: memcached haproxy

三个节点memcached.service处于活动状态(正在运行):

[root@ha-node3 my.cnf.d]# systemctl status   memcached.service
● memcached.service - memcached daemon
   Loaded: loaded (/usr/lib/systemd/system/memcached.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2017-08-02 01:01:29 CST; 6min ago
 Main PID: 13329 (memcached)
   CGroup: /system.slice/memcached.service
           └─13329 /usr/bin/memcached -p 11211 -u memcached -m 1024 -c 8192 -l 127.0.0.1,::1,10.10.0.101 -t 4 -I 10m

Aug 02 01:01:29 ha-node3 systemd[1]: Started memcached daemon.
Aug 02 01:01:29 ha-node3 systemd[1]: Starting memcached daemon...

但是在haproxy网站中,三个节点都已关闭。

enter image description here

修改-1

我发现端口Memcache_Servers中的/etc/haproxy/haproxy.cfg配置为22122(我写错了),所以我改为11211,然后重启haproxy,但仍然不行。

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

1 个答案:

答案 0 :(得分:0)

在决赛中,我发现我的主机中的ip如下:

[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

但在我的/etc/sysconfig/memcached中,ip之前不是主机ip,所以我在主机中更改为ip,你看到下面的快照:

enter image description here

现在我重新启动memcached和haproxy,它现在正常工作。

enter image description here