Skip to content

Commit 1e4af62

Browse files
Merge pull request #1612 from redis/DOC-430
DOC-430: Add instructions for flushing OSS Cluster API databases
2 parents 3d0785c + 7637de8 commit 1e4af62

File tree

1 file changed

+42
-2
lines changed
  • content/operate/rs/databases/import-export

1 file changed

+42
-2
lines changed

content/operate/rs/databases/import-export/flush.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ categories:
66
- operate
77
- rs
88
description: To delete the data in a database without deleting the database, you can
9-
use Redis CLI to flush it from the database. You can also use Redis CLI, the admin
10-
console, and the Redis Software REST API to flush data from Active-Active databases.
9+
use Redis CLI to flush it from the database. Learn how to flush data from standard databases,
10+
OSS Cluster API databases, and Active-Active databases using Redis CLI, the Cluster Manager UI,
11+
and the Redis Software REST API.
1112
linkTitle: Flush database
1213
weight: 40
1314
---
@@ -41,6 +42,45 @@ redis-cli -h redis-12345.cluster.local -p 9443 -a xyz flushall
4142
Port 9443 is the default [port configuration]({{< relref "/operate/rs/networking/port-configurations#https://docs.redis.com/latest/rs/networking/port-configurations#ports-and-port-ranges-used-by-redis-enterprise-software" >}}).
4243
{{< /note >}}
4344

45+
## Flush data from an OSS Cluster API database
46+
47+
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.
48+
49+
Follow these steps to flush all data from an OSS Cluster API database:
50+
51+
1. Find all IP addresses associated with the database endpoint using the `dig` command:
52+
53+
```sh
54+
dig +noall +answer <database-endpoint>
55+
```
56+
57+
2. Connect to each IP address using [`redis-cli`]({{<relref "/operate/rs/references/cli-utilities/redis-cli">}}) and run the [`FLUSHDB`]({{<relref "/commands/flushdb">}}) command:
58+
59+
```sh
60+
redis-cli -h <ip-address> -p <port> flushdb
61+
```
62+
63+
### Example
64+
65+
1. Find all IP addresses for the database endpoint:
66+
67+
```sh
68+
$ dig +noall +answer redis-19674.test2f4e15b0.cs.redislabs.com
69+
redis-19674.test2f4e15b0.cs.redislabs.com. 5 IN A 192.0.2.0
70+
redis-19674.test2f4e15b0.cs.redislabs.com. 5 IN A 198.51.100.0
71+
```
72+
73+
2. Connect to each IP address and flush the data:
74+
75+
```sh
76+
$ redis-cli -h 192.0.2.0 -p 19674 flushdb
77+
OK
78+
$ redis-cli -h 198.51.100.0 -p 19674 flushdb
79+
OK
80+
```
81+
82+
This ensures that all shards in the OSS Cluster API database are flushed properly.
83+
4484

4585
## Flush data from an Active-Active database
4686

0 commit comments

Comments
 (0)