[英]Configure a connection retry for a Redis instance
I plan to move my web site to a cloud one.我计划将我的网站移至云端。 I've been told there is some micro-interruptions in some services.有人告诉我,某些服务中存在一些微中断。
Therefore I'd like to configure a connection retry for the redis cache set up.因此,我想为 redis 缓存设置配置连接重试。
I'm using Symfony 4.2 with this configuration我正在使用具有此配置的 Symfony 4.2
framework:
cache:
app: cache.adapter.redis
default_redis_provider: '%env(REDIS_URL)%'
Is there any way to configure the retry_interval
option of redis in Symfony ?有什么办法可以在 Symfony 中配置 redis 的retry_interval
选项吗?
EDIT : including precisions of @simon.ro编辑:包括@simon.ro 的精度
Redis has an option retry_interval
which you can specify at connect-time. Redis 有一个选项retry_interval
您可以在连接时指定。 You should check the documentation of the redis connecting library you are using.您应该检查您正在使用的 redis 连接库的文档。
The default_redis_provider
is a DSN that will be parsed with parse_url
function default_redis_provider
是一个将使用parse_url
函数解析的 DSN
So you can add parameters into query string like this :因此,您可以将参数添加到查询字符串中,如下所示:
default_redis_provider: 'redis://u:pass@localhost/2:6379?retry_interval=300&timeout=10&read_timeout=30&tcp_keepalive=10'
path of url /2
is the dbindex of redis url /2
的路径是redis的dbindex
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.