How to Clear a Specific Redis Database Cache
Warning
FLUSHDB permanently deletes all keys in the selected Redis database.
Verify host and database index before running this command.
Prerequisites
- Network access to the Redis server
redis-cliinstalled- Correct Redis database index
Install client tools (if needed):
sudo apt update && sudo apt install redis-tools
Steps
- Connect to the Redis server and select the target database:
redis-cli -h prod-xxxx.amazonaws.com -d 2
- Run flush command:
flushdb async
- Verify response:
OK
Replace 2 with your target database index (0-based).
If you need to clear all databases (higher risk), use flushall async instead.