fedorshishi
fedorshishi

Reputation: 1477

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?

Upvotes: 2

Views: 4175

Answers (3)

Ganesh KuMar Ganesan
Ganesh KuMar Ganesan

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.

FLUSHALL

Upvotes: 1

YuriBro
YuriBro

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

Didier Spezia
Didier Spezia

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

Related Questions