最近,我刚刚开始在Laravel应用程序中使用AWS ElastiCache。该应用程序运行在一个ELB后面的两个实例上,处理大约6-10个请求/秒。当我启动应用程序时,一切都进行得很好,但随后我开始接收到具有高延迟和超时的应用程序的连接错误。错误信息如下:
[2016-05-17 07:28:25] production.ERROR: exception 'RuntimeException' with message 'Could not establish Memcached connection.' in /srv/ensemble/laravel/vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php:38 Stack trace:
#0/srv/ensemble/laravel/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(164): Illuminate\Cache\MemcachedConnector->connect(Array)
#1 /srv/ensemble/laravel/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(102): Illuminate\Cache\CacheManager->createMemcachedDriver(Array) #2 /srv/ensemble/laravel/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(77): Illuminate\Cache\CacheManager->resolve('memcached')...在我的设置中,我使用:
为了暂时解决我的问题,我在一个单独的EC2实例上安装了memcached,并且没有任何问题。
我的问题是,我是否需要使用AWS ElastiCache PHP客户端而不是php5-memcached来使用Elasticache?我当时的印象是,Elasticache是Memcached的替代品,可以在没有问题的情况下使用。
谢谢你的帮助!
发布于 2020-05-01 12:39:48
在AWS中使用管理服务时,很少有什么重要的考虑因素,例如Elasticache。
关于您的问题,应用程序无法建立到缓存实例的连接,此错误显示该问题发生在网络的某个地方。这个问题是很普遍的。
最有可能是
allow IP 172.0.1.1/32 to port 11211

发布于 2019-08-23 17:30:50
检查您的安全组设置是什么,并将它们设置为0.0.0.0/32(不是安全的--向每个人开放,但是是一种很好的测试方法),那么如果这样做有效,只需将其设置为您的公共ip地址(您可以在这里找到https://www.whatismyip.com/what-is-my-public-ip-address/ )。
https://stackoverflow.com/questions/37306112
复制相似问题