If you are using Redis, it can be beneficial to flush the Redis database after problems or using a backup. This ensures that the keys in a database are being erased. Below are instructions on how to do this via SSH for both one database, or all of them.
Flush all Redis databases
- Open your terminal and set up a SSH connection with your hosting package.
Run the following command if you want to erase all keys from all databases:
$ redis-cli -s /tmp/redis.sock FLUSHALL
Flush specific Redis databases
If you have multiple websites on your hosting package and use therefore different Redis databases, you can also erase the key from a specific database. The instructions are then as the following.
- Open your terminal and set up a SSH connection with your hosting package.
Run the command below. Replace <db> with the number your to-be-erased database corresponds to (0 up and including 15).
$ redis-cli -n <db> -s /tmp/redis.sock FLUSHDB
The default database is 0. If you leave out -n <db>, the keys from database 0 are then being erased.