Skip to content
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

fix: m/s replication when using ipv6 #827

Merged
merged 4 commits into from
Mar 15, 2024

Conversation

jmtsi
Copy link
Contributor

@jmtsi jmtsi commented Mar 13, 2024

Description

I couldn't get the master-follower replication working in my IPv6 EKS cluster. When the operator tried to set up the replication, the follower logged errors:

13 Mar 2024 16:46:20.357 * Connecting to MASTER [2a05:d028:10:482:cae3::3]:6379
13 Mar 2024 16:46:20.360 # Unable to connect to MASTER: Resource temporarily unavailable

If I manually ran the slaveof command without using brackets, the replication started successfully:

13 Mar 2024 16:46:21.250 * Connecting to MASTER 2a05:d028:10:482:cae3::3:6379
13 Mar 2024 16:46:21.250 * MASTER <-> REPLICA sync started

This PR modifies the getRedisServerIP function to return the plain IPv6 address, as the brackets should only be added when using <ipv6_addr>:<port> pairs, as per RFC5952.

I also add new function getRedisServerAddress, which handles the address formatting.

Fixes #309, #139

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • Tests have been added/modified and all tests pass.
  • Functionality/bugs have been confirmed to be unchanged or fixed.
  • I have performed a self-review of my own code.
  • Documentation has been updated or added where necessary.

Additional Context

This fixes the IPv6 support which was working previously only for the standalone instances.

@jmtsi jmtsi force-pushed the fix/ipv6-support branch from ab03374 to 49af107 Compare March 13, 2024 19:36
@jmtsi jmtsi changed the title Fix IPv6 address syntax Fix IPv6 support Mar 13, 2024
@drivebyer drivebyer changed the title Fix IPv6 support fix: m/s replication when using ipv6 Mar 14, 2024
Copy link

codecov bot commented Mar 14, 2024

Codecov Report

Attention: Patch coverage is 42.85714% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 35.75%. Comparing base (d121d86) to head (81a9c23).
Report is 6 commits behind head on master.

Files Patch % Lines
k8sutils/cluster-scaling.go 0.00% 8 Missing ⚠️
k8sutils/redis.go 69.23% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #827      +/-   ##
==========================================
+ Coverage   35.20%   35.75%   +0.55%     
==========================================
  Files          19       19              
  Lines        3213     2629     -584     
==========================================
- Hits         1131      940     -191     
+ Misses       2015     1620     -395     
- Partials       67       69       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@drivebyer
Copy link
Collaborator

drivebyer commented Mar 14, 2024

Thanks for your contribution. I'm not quite sure when to add brackets or not. I noticed that getRedisServerIP in the AddRedisNodeToCluster function is not being replaced. By the way, does Redis Cluster still work fine on IPv6? @jmtsi

@drivebyer drivebyer self-requested a review March 14, 2024 06:29
@jmtsi jmtsi force-pushed the fix/ipv6-support branch from 54ddfd7 to beaf631 Compare March 14, 2024 09:26
@jmtsi
Copy link
Contributor Author

jmtsi commented Mar 14, 2024

@drivebyer Good catch! Somehow I missed those from my commit. All the remaining references have now been checked and replaced.

I'll test the cluster-mode with IPv6 today and see that it works without problems.

@jmtsi
Copy link
Contributor Author

jmtsi commented Mar 14, 2024

@drivebyer After these latest changes I can successfully create a cluster-mode Redis in my IPv6 cluster and the m/s replication works without problems.

Edit: I noticed that commit authoring was wrong, so force pushed the branch with correct information.

@jmtsi jmtsi force-pushed the fix/ipv6-support branch from beaf631 to 81a9c23 Compare March 14, 2024 13:00
@drivebyer drivebyer merged commit 1cf27bb into OT-CONTAINER-KIT:master Mar 15, 2024
27 checks passed
@jmtsi jmtsi deleted the fix/ipv6-support branch March 15, 2024 12:50
mattrobinsonsre pushed a commit to mattrobinsonsre/redis-operator that referenced this pull request Jul 11, 2024
* Delete unnecessary brackets wrapping the IPv6 address

Signed-off-by: Jami Karvanen <[email protected]>

* Extract redis address formatting into separate getRedisServerAddress function

Signed-off-by: Jami Karvanen <[email protected]>

* Add tests for getRedisServerAddress

Signed-off-by: Jami Karvanen <[email protected]>

* Use getRedisServerAddress also in cluster-scaling.go

Signed-off-by: Jami Karvanen <[email protected]>

---------

Signed-off-by: Jami Karvanen <[email protected]>
Signed-off-by: Matt Robinson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Could not connect to Redis at [IPv6]:6379: Name does not resolve
2 participants