Help Center/ Distributed Cache Service/ FAQs/ Redis Commands/ How Do I Clear Redis Data?
Updated on 2024-09-24 GMT+08:00

How Do I Clear Redis Data?

Exercise caution when clearing data.

  • Redis 3.0

    Data of a DCS Redis 3.0 instance cannot be cleared on the console, and can only be cleared by the FLUSHDB or FLUSHALL command in redis-cli.

    Run the FLUSHALL command to clear all the data in the instance.

    Run the FLUSHDB command to clear the data in the currently selected database.

  • Redis 4.0 or later

    Access the instance in redis-cli or using Web CLI on the console and run command FLUSHDB or FLUSHALL. Or choose More > Clear Data on the DCS console to clear Redis data all at once.

    Cluster instances do not support multi-DB by default. They consist of shards. To use commands FLUSHDB or FLUSHALL to clear data for these instances, run them on every shard. Otherwise, there may be data remanence.

    • Currently, only DCS Redis 4.0 and later instances support Clear Data on the console and instance access using Web CLI on the console.
    • Running FLUSHDB command on Web CLI clears only one shard at a time. If there are multiple shards, use the CLI to access the master node of each shard and run the FLUSHDB command.
    • Redis Cluster data cannot be cleared by using Web CLI.