[フレーム]
Docs Pricing
Login Book a meeting Try Redis

Flush database data

To delete the data in a database without deleting the database, you can use Redis CLI to flush it from the database. Learn how to flush data from standard databases, OSS Cluster API databases, and Active-Active databases using Redis CLI, the Cluster Manager UI, and the Redis Software REST API.

Redis Enterprise Software

To delete the data in a database without deleting the database configuration, you can flush the data from the database.

You can use the Cluster Manager UI to flush data from Active-Active databases.

Warning:
The flush command deletes ALL in-memory and persistence data in the database. We recommend that you back up your database before you flush the data.

Flush data from a database

From the command line, you can flush a database with the redis-cli command or with your favorite Redis client.

To flush data from a database with the redis-cli, run:

redis-cli -h <hostname> -p <portnumber> -a <password> flushall

Example:

redis-cli -h redis-12345.cluster.local -p 9443 -a xyz flushall
Note:
Port 9443 is the default port configuration.

Flush data from an OSS Cluster API database

When using the OSS Cluster API, the FLUSHDB command only flushes the keys of the shard you're connected to, not all keys in the database. To flush all data from an OSS Cluster API database, you need to connect to each endpoint IP address and run the flush command.

Follow these steps to flush all data from an OSS Cluster API database:

  1. Find all IP addresses associated with the database endpoint using the dig command:

    dig +noall +answer <database-endpoint>
    
  2. Connect to each IP address using redis-cli and run the FLUSHDB command:

    redis-cli -h <ip-address> -p <port> flushdb
    

Example

  1. Find all IP addresses for the database endpoint:

    $ dig +noall +answer redis-19674.test2f4e15b0.cs.redislabs.com
    redis-19674.test2f4e15b0.cs.redislabs.com. 5 IN A 192.0.2.0
    redis-19674.test2f4e15b0.cs.redislabs.com. 5 IN A 198.51.100.0
    
  2. Connect to each IP address and flush the data:

    $ redis-cli -h 192.0.2.0 -p 19674 flushdb
    OK
    $ redis-cli -h 198.51.100.0 -p 19674 flushdb
    OK
    

This ensures that all shards in the OSS Cluster API database are flushed properly.

Flush data from an Active-Active database

When you flush an Active-Active database (formerly known as CRDB), all of the replicas flush their data at the same time.

To flush data from an Active-Active database, use one of the following methods:

RATE THIS PAGE
Back to top ↑

On this page

AltStyle によって変換されたページ (->オリジナル) /