Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/clustering.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,21 @@ Commands such as `GET`, `SET`, etc. are routed by the first key, for instance `M

Admin commands such as `MEMORY STATS`, `FLUSHALL`, etc. are not attached to the cluster, and must be executed on a specific node via `.getSlotMaster()`.

#Here is an example of how to FLUSHALL the cluster:

```javascript
await Promise.all(
cluster.masters.map(async item => {
const client = await cluster.nodeClient(item)
await client.flushAll();
});
);
```
The `cluster.masters` refers to the total number of master nodes in the Redis cluster.
The `cluster.replicas` indicates the total number of replica nodes in the Redis cluster
The `cluster.shards` refers to the number of shards in the Redis cluster.
The `cluster.slots` indicates the total number of slots in the Redis cluster.

### "Forwarded Commands"

Certain commands (e.g. `PUBLISH`) are forwarded to other cluster nodes by the Redis server. This client sends these commands to a random node in order to spread the load across the cluster.