MemcachePool::get():服务器localhost(tcp 11211,udp 0)失败,原因是:网络超时


MemcachePool::get(): Server localhost (tcp 11211, udp 0) failed with: Network timeout

我已经使用Memcache和PHP很长时间了,一切都很好,但现在我每隔10到15分钟就会出现这个错误。

MemcachePool::get(): Server localhost (tcp 11211, udp 0) failed with: Network timeout

我认为这可能是由于防火墙之类的原因,所以我打开了防火墙,但没有停止发送此消息。

每次出现错误后,我都必须重新启动内存缓存。

而且它是Memcache,而不是带有PHP 5.4 MSVC9 TS版本的Windows7机器上的D。我不明白现在该如何处理网络超时问题。可以做些什么来解决这个问题。

目前,我只有一台带有Windows7的本地机器,因此无法制作Memcache集群或安装Memcache(D)。

不确定是内存缓存守护程序问题还是客户端问题。

我遇到了同样的问题,在Windows 10上安装了php,在Ubuntu上安装了Memcached(在Linux的Windows子系统中运行)

在我的情况下,问题是localhost解析为[::1]:

>ping localhost
Pinging SURFACE-PRO-FRA [::1] with 32 bytes of data:

默认情况下,Memcached只在127.0.0.1上侦听。

为了解决这个问题,您可以让Memcached也在ipv6上侦听:

$ sudo vi /etc/memcached.conf

更换

-l 127.0.0.1

带有:

-l 127.0.0.1,::1

然后

sudo service memcached restart

或者,让您的应用程序连接到127.0.0.1,而不是localhost