Reputation: 1477
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?
Upvotes: 2
Views: 4175
Reputation: 21
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.
Upvotes: 1
Reputation: 902
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 ))
Upvotes: 3
Reputation: 73236
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.
Upvotes: 2