简体   繁体   中英

redis hangs on flushall command

I used FLUSHALL command to drop my redis cache. 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. 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. 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 ASYNC (Redis 4.0.0 or greater)

Redis is now able to delete keys in the background in a different thread without blocking the server. An ASYNC option was added to FLUSHALL and FLUSHDB in order to let the entire dataset or a single database to be freed asynchronously.

Asynchronous FLUSHALL and FLUSHDB commands only delete keys that were present at the time the command was invoked. Keys created during an asynchronous flush will be unaffected.

FLUSHALL

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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