From 6e25f2c9142406c8f658993dcc30e8884a160f47 Mon Sep 17 00:00:00 2001 From: Anantharaj Date: Mon, 3 Jul 2023 21:42:56 +0530 Subject: [PATCH] Docs: Update Info on How to use FLUSHALL command with createCluster --- docs/clustering.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/clustering.md b/docs/clustering.md index 28ea0e2964c..509b7ed6bfd 100644 --- a/docs/clustering.md +++ b/docs/clustering.md @@ -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.