我如何杀死空闲的 redis 客户端 [英] how do I kill idle redis clients

查看:45
本文介绍了我如何杀死空闲的 redis 客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想超时并杀死空闲的 redis 客户端.有没有我可以设置的设置来做到这一点?我好像记得在某处设置了一个配置,但我似乎找不到了.

I want to timeout and kill idle redis clients. Is there a setting I can set to do this? I seem to remember setting a configuration somewhere but I can't seem to find it again.

我希望这能自动完成,而不是手动调用客户端 kill 命令.

I want this to be done automatically, rather than manually calling the client kill command.

推荐答案

查看 Redis 配置文件(用于启动 Redis 的文件).

Have a look into the Redis configuration file (the one you use to launch Redis).

# Close the connection after a client is idle for N seconds (0 to disable)
timeout 0

只要检查参数没有被注释掉,然后将超时参数更改为以秒为单位的非零值.应重新启动实例以考虑此参数.

Just check the parameter is not commented out, and change the timeout parameter to put a non zero value in seconds. The instance should be restarted to take this parameter in account.

要在正在运行的 Redis 实例上更改此参数,您可以使用客户端命令:

To change this parameter on a running Redis instance, you can use a client command:

> src/redis-cli config set timeout 10
OK
> src/redis-cli config get timeout
1) "timeout"
2) "10"

这篇关于我如何杀死空闲的 redis 客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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