连接时Redis客户端超时 [英] Redis client times out when connecting

查看:103
本文介绍了连接时Redis客户端超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ElastiCache上运行Redis集群。

I have a Redis cluster running on ElastiCache.

多个进程连接到Redis集群。每个进程都位于Docker容器中。流程不尽相同-我有一个 web 流程,一个 worker 流程,等等。

Multiple processes connect to the Redis cluster. Each process lives within a Docker container. The processes are not all the same -- I have a web process, a worker process, etc.

正常运行几天后,连接到Redis时,我的某些 web 进程开始超时。当我 ssh 进入受影响的 web 容器并尝试通过 redis-cli到达群集时,我与集群的连接超时。这告诉我,问题不仅影响 web 过程,而且影响整个容器。

After a few days of operating normally, some of my web processes begin to time out when connecting to Redis. When I ssh into an affected web container and try to reach the cluster via redis-cli, my connection to the cluster times out. This tells me that the issue affects the entire container, and not just the web process.

当我使用 redis-cli 从任何其他容器中连接,我都没有问题。

When I use redis-cli from any other container, I connect without problems.

我的网络进程根据需要创建新的连接,并在长时间闲置时关闭旧连接。我的猜测是,任何给定的Docker容器在达到某种限制之前都可以打开一定数量的连接。几天后,我的 web 容器达到了该限制。

My web processes create new connections as needed, and close old connections when they're idle for a long time. My guess is that any given Docker container can open a certain number of connections before reaching some kind of limit. After a few days, my web containers reach that limit.

有什么办法解决这个问题吗?

Any idea how to go about fixing this?

-

一个详细信息:由于某种原因,重置我的Redis群集可解决所有 web 容器。也许Redis服务器对从给定IP地址可以打开多少个连接施加了限制?

One more detail: for some reason, resetting my Redis cluster fixes the issue across all web containers. Maybe the Redis server imposes a limit on how many connections can be opened from a given IP address?

推荐答案

Josiah和我有一个在Redis Google小组上进行的长期讨论有助于解决我的问题;希望讨论可以对以后的人有所帮助。

Josiah and I had a long discussion on the Redis Google group which helped solve my issue; hopefully the discussion can help someone else in the future.

这篇关于连接时Redis客户端超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆