-
Notifications
You must be signed in to change notification settings - Fork 703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dual stack and client-specific IPs in cluster #736
Conversation
Signed-off-by: Viktor Söderqvist <[email protected]>
The cached conn type enum is replaced by an integer bitmap with one bit for TLS, IPv6 and RESP3. The definition is moved from connection.h to server.h. It has actually nothing to do with the connection.h abstraction. Signed-off-by: Viktor Söderqvist <[email protected]>
Signed-off-by: Viktor Söderqvist <[email protected]>
Signed-off-by: Viktor Söderqvist <[email protected]>
Signed-off-by: Viktor Söderqvist <[email protected]>
Signed-off-by: Viktor Söderqvist <[email protected]>
Signed-off-by: Viktor Söderqvist <[email protected]>
Signed-off-by: Viktor Söderqvist <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #736 +/- ##
============================================
+ Coverage 70.20% 70.27% +0.06%
============================================
Files 111 111
Lines 60242 60365 +123
============================================
+ Hits 42295 42419 +124
+ Misses 17947 17946 -1
|
Signed-off-by: Viktor Söderqvist <[email protected]>
Signed-off-by: Viktor Söderqvist <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, only 2 comments for this PR
Signed-off-by: Viktor Söderqvist <[email protected]>
…alled with) Updates code for human nodename too, accordingly. Signed-off-by: Viktor Söderqvist <[email protected]>
Signed-off-by: Viktor Söderqvist <[email protected]>
Signed-off-by: Viktor Söderqvist <[email protected]>
Signed-off-by: Viktor Söderqvist <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am done reviewing. Overall LGTM with 2 areas that I hope we can improve:
- boilerplate code reduction
- naming consistency
Also, I think we will need a new VM_GetClusterNodeInfo
module API that takes a client *
argument.
Signed-off-by: Viktor Söderqvist <[email protected]>
Signed-off-by: Viktor Söderqvist <[email protected]>
and add 'static' for some internal functions. Signed-off-by: Viktor Söderqvist <[email protected]>
Signed-off-by: Viktor Söderqvist <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR looks great! :-)
Signed-off-by: Viktor Söderqvist <[email protected]>
Signed-off-by: Viktor Söderqvist <[email protected]>
Signed-off-by: Viktor Söderqvist <[email protected]>
Signed-off-by: Viktor Söderqvist <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
New configs: * `cluster-announce-client-ipv4` * `cluster-announce-client-ipv6` New module API function: * `ValkeyModule_GetClusterNodeInfoForClient`, takes a client id and is otherwise just like its non-ForClient cousin. If configured, one of these IP addresses are reported to each client in CLUSTER SLOTS, CLUSTER SHARDS, CLUSTER NODES and redirects, replacing the IP (`custer-announce-ip` or the auto-detected IP) of each node. Which one is reported to the client depends on whether the client is connected over IPv4 or IPv6. Benefits: * This allows clients using IPv4 to get the IPv4 addresses of all cluster nodes and IPv6 clients to get the IPv6 clients. * This allows the IPs visible to clients to be different to the IPs used between the cluster nodes due to NAT'ing. The information is propagated in the cluster bus using new Ping extensions. (Old nodes without this feature ignore unknown Ping extensions.) This adds another dimension to CLUSTER SLOTS reply. It now depends on the client's use of TLS, the IP address family and RESP version. Refactoring: The cached connection type definition is moved from connection.h (it actually has nothing to do with the connection abstraction) to server.h and is changed to a bitmap, with one bit for each of TLS, IPv6 and RESP3. Fixes valkey-io#337 --------- Signed-off-by: Viktor Söderqvist <[email protected]>
Fix a bug in isValidAuxChar where valid characters '.' and ':' were incorrectly included in the banned charset. This issue affected the validation of auxiliary fields in the nodes.conf file used by Valkey in cluster mode, particularly when handling IPv4 and IPv6 addresses. The code now correctly allows '.' and ':' as valid characters, ensuring proper handling of these fields. Comments were added to clarify the use of the banned charset. Related to #736 --------- Signed-off-by: Ping Xie <[email protected]>
Fix a bug in isValidAuxChar where valid characters '.' and ':' were incorrectly included in the banned charset. This issue affected the validation of auxiliary fields in the nodes.conf file used by Valkey in cluster mode, particularly when handling IPv4 and IPv6 addresses. The code now correctly allows '.' and ':' as valid characters, ensuring proper handling of these fields. Comments were added to clarify the use of the banned charset. Related to #736 --------- Signed-off-by: Ping Xie <[email protected]>
Fix a bug in isValidAuxChar where valid characters '.' and ':' were incorrectly included in the banned charset. This issue affected the validation of auxiliary fields in the nodes.conf file used by Valkey in cluster mode, particularly when handling IPv4 and IPv6 addresses. The code now correctly allows '.' and ':' as valid characters, ensuring proper handling of these fields. Comments were added to clarify the use of the banned charset. Related to #736 --------- Signed-off-by: Ping Xie <[email protected]>
I think But, the cluster information shows the I create the cluster using
but the result changes the IP to the public IP:
The weird thing is that it works. The cluster ports (17001-17003) are not exposed. Can the cluster appear to work correctly even if these ports are not reachable? |
Hi Erik, well, the valkey nodes use the the private IP and cluster ports (1700x) when they talk to each other. The cluster ports don't need to be reachable by clients. I agree it's a bit weird that CLUSTER NODES displays the cluster ports together with the client IPs. I don't know how we can display it in a backward-compatible way. Do you have a better idea? CLUSTER SLOTS doesn't show the cluster ports. It's only for clients. |
@zuiderkwast Oh, right, it makes sense that from the client's perspective (valkey-cli), the IPs are overridden. But then how can you monitor the actual configuration? Is there another way to monitor the cluster health and configuration? It makes debugging complicated when the private ips are not known. |
Client libraries are supposed to use CLUSTER SLOTS to discover the cluster slot mapping, but we know that several clients still use CLUSTER NODES for this. Breaking clients seems risky. Are you relying on CLUSTER NODES in some admin script or tool that will break with this new config? There's yet another command: CLUSTER SHARDS. This one is more extensible with key-value fields so we can probably consider including all IP variants there. |
New configs:
cluster-announce-client-ipv4
cluster-announce-client-ipv6
New module API function:
ValkeyModule_GetClusterNodeInfoForClient
, takes a client id and is otherwise just like its non-ForClient cousin.If configured, one of these IP addresses are reported to each client in CLUSTER SLOTS, CLUSTER SHARDS, CLUSTER NODES and redirects, replacing the IP (
custer-announce-ip
or the auto-detected IP) of each node. Which one is reported to the client depends on whether the client is connected over IPv4 or IPv6.Benefits:
The information is propagated in the cluster bus using new Ping extensions. (Old nodes without this feature ignore unknown Ping extensions.)
This adds another dimension to CLUSTER SLOTS reply. It now depends on the client's use of TLS, the IP address family and RESP version. Refactoring: The cached connection type definition is moved from connection.h (it actually has nothing to do with the connection abstraction) to server.h and is changed to a bitmap, with one bit for each of TLS, IPv6 and RESP3.
Fixes #337