Skip to content

Commit 806a16a

Browse files
authored
Mention that IPv6 addresses are *not* enclosed in brackets (#358)
Fixes valkey-io/valkey#2578 --------- Signed-off-by: Viktor Söderqvist <[email protected]>
1 parent 4af6c53 commit 806a16a

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

commands/client-capa.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ The capabilities currently supported are:
99
* `redirect` - This indicates that the client is capable of handling redirect messages.
1010
When accessing a replica node in standalone mode, if a data operation is performed (read or write commands),
1111
Valkey will return `-REDIRECT primary-ip:port` to this connection.
12+
Note that the `primary-ip` can be an IPv6 which itself contains colons, so to properly parse ip and port, a client needs to locate the *last* colon.
1213
Using the [`READONLY`](readonly.md) command can enable this connection to execute read commands on the replica node.

commands/cluster-nodes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ The meaning of each field is the following:
4040
1. `id`: The node ID, a 40-character globally unique string generated when a node is created and never changed again (unless [`CLUSTER RESET HARD`](cluster-reset.md) is used).
4141
2. `ip:port@cport`: The node address that clients should contact to run queries, along with the used cluster bus port.
4242
`:0@0` can be expected when the address is no longer known for this node ID, hence flagged with `noaddr`.
43+
Note that `ip` can be an IPv6 address, which can contain multiple colons.
44+
Here, an IPv6 address is *not* enclosed in square brackets as it would be in other contexts such as URIs.
45+
To properly split the `ip:port@cport` into `ip` and `port@cport`, you need to locate the *last* colon.
4346
3. `hostname`: A human readable string that can be configured via the `cluster-annouce-hostname` setting. The max length of the string is 256 characters, excluding the null terminator. The name can contain ASCII alphanumeric characters, '-', and '.' only.
4447
5. `flags`: A list of comma separated flags: `myself`, `master`, `slave`, `fail?`, `fail`, `handshake`, `noaddr`, `nofailover`, `noflags`. Flags are explained below.
4548
6. `master`: If the node is a replica, and the primary is known, the primary node ID, otherwise the "-" character.

topics/cluster-spec.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,10 @@ The client needs to reissue the query to the specified node's endpoint address a
373373
The endpoint can be either an IP address, a hostname, or it can be empty (e.g. `-MOVED 3999 :6380`).
374374
An empty endpoint indicates that the server node has an unknown endpoint, and the client should send the next request to the same endpoint as the current request but with the provided port.
375375

376+
The endpoint can be an IPv6 address, which can contain multiple colons.
377+
Here, an IPv6 address is *not* enclosed in square brackets as it would be in other contexts such as URIs.
378+
To properly split the string `endpoint:port` into `endpoint` and `port`, a cluster client needs to locate the *last* colon.
379+
376380
Note that even if the client waits a long time before reissuing the query,
377381
and in the meantime the cluster configuration changed, the destination node
378382
will reply again with a MOVED error if the hash slot 3999 is now served by

wordlist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,7 @@ Unwatches
926926
unwatches
927927
uppercased
928928
urandom
929+
URIs
929930
used_memory_scripts_eval
930931
userSession
931932
usr

0 commit comments

Comments
 (0)