# CLUSTER NODES

> Return every node the receiving node knows, one line each, in the nodes.conf format.

URL: https://docs.hotkv.com/commands/cluster-nodes/

```
CLUSTER NODES
```

- Group: Cluster
- Complexity: O(N) where N is the number of known nodes
- HotKV Cloud: all plans
- On-Premise: no license needed

`CLUSTER NODES` returns the receiving node's view of the cluster as text:
one line per known node, in the same format the node keeps in `nodes.conf`.
Cluster tools and client libraries parse it; for a structured reply, use
[CLUSTER SHARDS](https://docs.hotkv.com/commands/cluster-shards/index.md).

## Line format

Each line has these fields, separated by spaces:

```
<id> <ip>:<port>@<bus-port>[,<hostname>] <flags> <primary-id> <ping-sent> <pong-received> <config-epoch> <link-state> [<slot> ...]
```

| Field | Meaning |
| --- | --- |
| `id` | The node ID |
| `ip:port@bus-port` | The node's address, client port and cluster bus port. The address and client port are the ones the node announces to clients (`cluster-announce-client-ipv4` and `cluster-announce-client-port` when it has them), also on the node's own line. The client port is the TLS port when you are connected over TLS. A hostname (`cluster-announce-hostname`) follows after a comma when the node has one. |
| `flags` | Comma-separated: `myself`, `master`, `slave`, `fail?` (suspected failing), `fail`, `handshake`, `noaddr`, `nofailover`, or `noflags` |
| `primary-id` | For a replica, its primary's ID, otherwise `-` |
| `ping-sent` | Unix time in milliseconds of a ping still waiting for its answer, otherwise `0` |
| `pong-received` | Unix time in milliseconds of the last answer from the node (`0` for the node itself) |
| `config-epoch` | The node's configuration epoch |
| `link-state` | `connected` or `disconnected` |
| `slot` | The slots the node serves, as single numbers or `start-end` ranges |

On the line of the node itself, slots it is moving appear at the end as
`[<slot>->-<target-id>]` (migrating) and `[<slot>-<-<source-id>]`
(importing).

## Return value

A bulk string in RESP2 and RESP3, one line per node, each ending in a
newline. With cluster mode off it holds only the node's own line.

## Examples

```
127.0.0.1:6379> CLUSTER NODES
b4240bf759694b9ba85b3b5efd51785b86261c3e 10.0.0.1:6379@16379 myself,master - 0 0 1 connected 0-5460
0e2a97d798979a2e3e5e7f940e2ac533fb36b69b 10.0.0.2:6379@16379 master - 0 1790850431022 2 connected 5461-10922
db0203ba69a674ed0b0cde72c4dfcecc846ed307 10.0.0.3:6379@16379 master - 0 1790850432027 3 connected 10923-16383
80c69623243ebb98309adbe1d4c95f7857e37c2c 10.0.0.4:6379@16379 slave b4240bf759694b9ba85b3b5efd51785b86261c3e 0 1790850431525 1 connected
a406ec695ab17e4f731d29cd54e36d4ce81e2c65 10.0.0.5:6379@16379 slave 0e2a97d798979a2e3e5e7f940e2ac533fb36b69b 0 1790850432530 2 connected
087d5d8db5c8df0f3152afcd17b94d5879f9107f 10.0.0.6:6379@16379 slave db0203ba69a674ed0b0cde72c4dfcecc846ed307 0 1790850430518 3 connected
```

With `--cluster-announce-client-ipv4 10.0.0.1`, `--cluster-announce-client-port 7000`
and `--cluster-announce-hostname host0.example.com` on a node whose cluster
bus is on port 17005:

```
127.0.0.1:7005> CLUSTER NODES
7a28581ffafcbe156e07d2e0fc7107eb808e2f1f 10.0.0.1:7000@17005,host0.example.com myself,master - 0 0 0 connected 0-16383
```

## Compatibility

Same line format as Redis 7 and Valkey 8, including the hostname after the
address.

## See also

[CLUSTER SHARDS](https://docs.hotkv.com/commands/cluster-shards/index.md), [CLUSTER SLOTS](https://docs.hotkv.com/commands/cluster-slots/index.md),
[CLUSTER REPLICAS](https://docs.hotkv.com/commands/cluster-replicas/index.md), [CLUSTER MYID](https://docs.hotkv.com/commands/cluster-myid/index.md)

In a cluster: [Monitoring a cluster](https://docs.hotkv.com/clustering/monitoring/index.md)