Suggest an editImprove this articleRefine the answer for “How do you tell whether a Redis node is a master or a replica?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)The fastest, most reliable way is the `INFO replication` command, where the `role:` field shows `master` or `slave` (`replica` in newer versions); a more concise alternative is the `ROLE` command, which returns the same information in a compact form. **Key point:** if Redis Sentinel is in use, the current master and its replicas can also be found via `redis-cli -p 26379 SENTINEL masters`.Shown above the full answer for quick recall.Answer (EN)ImageThere are several ways to find out whether a Redis node is a **master** or a **replica**: ### 1. Via the `INFO replication` command This is the main and most reliable way. **Example:** ```bash redis-cli INFO replication ``` **Output:** ```javascript # Replication role:master connected_slaves:1 slave0:ip=127.0.0.1,port=6380,state=online,offset=1203,lag=0 ``` or ```javascript # Replication role:slave master_host:127.0.0.1 master_port:6379 master_link_status:up ``` The `role:` field shows what this node is: - `role:master`, this is the **primary node**. - `role:slave` (or `role:replica` in newer versions), this is a **replica**. ### 2. Via the `ROLE` command A more concise alternative. **Example:** ```bash redis-cli ROLE ``` **Possible responses:** - For a master: ```javascript 1) "master" 2) (integer) 12345 3) (array) ... ``` - For a replica: ```javascript 1) "slave" 2) "127.0.0.1" 3) (integer) 6379 4) "connected" 5) (integer) 12345 ``` ### 3. Via Redis Sentinel (if it's in use) If you have Sentinel configured: ```bash redis-cli -p 26379 SENTINEL masters ``` This shows the current master and its replicas. **In short:** → The fastest way is `redis-cli INFO replication` and checking the `role:` field.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.