简体   繁体   English

redis挂在flushall命令上

[英]redis hangs on flushall command

I used FLUSHALL command to drop my redis cache.我使用 FLUSHALL 命令删除我的 redis 缓存。 From doc:来自文档:

Delete all the keys of all the existing databases, not just the currently selected one.删除所有现有数据库的所有键,而不仅仅是当前选择的键。 This command never fails .这个命令永远不会失败

But it hangs on my huge redis instance(in my case about to 20GB) and than i terminate redis server, clear redis backup dir and start redis server back.但它挂在我巨大的 redis 实例上(在我的情况下大约为 20GB),然后我终止 redis 服务器,清除 redis 备份目录并重新启动 redis 服务器。 Everything seems good but is it good way to do so?一切似乎都很好,但这样做是个好方法吗? And why flushall hang?为什么冲洗挂起?

I've faced with the same problem, my xeon with 64G memory was not responding about two hours.我遇到了同样的问题,我的 64G 内存至强在大约两个小时内没有响应。 Finally I used最后我用

kill -9 redisPID
rm dump.rdb
service redis restart

Worked like a charm ))像魅力一样工作))

It hangs because it has to delete millions of items.它挂起是因为它必须删除数百万个项目。 It takes a while because it has to scan everything.这需要一段时间,因为它必须扫描所有内容。 You may also have part of the data swapped out.您可能还会换出部分数据。

You may want to check that the machine does not swap when flushall is running.您可能需要检查机器在运行 flushall 时是否没有交换。

FLUSHALL ASYNC (Redis 4.0.0 or greater) FLUSHALL ASYNC(Redis 4.0.0 或更高版本)

Redis is now able to delete keys in the background in a different thread without blocking the server. Redis 现在可以在不同线程的后台删除键,而不会阻塞服务器。 An ASYNC option was added to FLUSHALL and FLUSHDB in order to let the entire dataset or a single database to be freed asynchronously.向 FLUSHALL 和 FLUSHDB 添加了 ASYNC 选项,以便异步释放整个数据集或单个数据库。

Asynchronous FLUSHALL and FLUSHDB commands only delete keys that were present at the time the command was invoked.异步 FLUSHALL 和 FLUSHDB 命令仅删除调用命令时存在的键。 Keys created during an asynchronous flush will be unaffected.在异步刷新期间创建的键将不受影响。

FLUSHALL冲洗

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM