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

SetClusterNodes allow to match localhost and real ip when listening on 0.0.0.0 #1381

Closed
1 of 2 tasks
git-hulk opened this issue Apr 12, 2023 · 2 comments · Fixed by #1392
Closed
1 of 2 tasks

SetClusterNodes allow to match localhost and real ip when listening on 0.0.0.0 #1381

git-hulk opened this issue Apr 12, 2023 · 2 comments · Fixed by #1392
Assignees
Labels
enhancement type enhancement good first issue Good for newcomers

Comments

@git-hulk
Copy link
Member

Search before asking

  • I had searched in the issues and found no similar issues.

Motivation

Currently, SetClusterNodes can't match the node if the instance is listening on 0.0.0.0 instead of the real IP.

For example, the cluster topology is: lohMbHeln658feDcRVKYb4tT7XClAm3Zr4awKuoK 127.0.0.1 6666 master - 0-16383, but the listen address is 0.0.0.0, then it won't match the cluster node since the listen IP is not strictly equal to cluster's node IP 127.0.0.1(as well as not localhost IP like 172.14.1.x).

This would confuse users because the cluster didn't work as their expected.

Solution

Check the IP address is matched by the real listening IP addresses instead of the bind address directly when using 0.0.0.0.

https://github.com/apache/incubator-kvrocks/blob/unstable/src/cluster/cluster.cc#L211

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@git-hulk git-hulk added enhancement type enhancement good first issue Good for newcomers labels Apr 12, 2023
@zevin02
Copy link
Contributor

zevin02 commented Apr 13, 2023

please assign to me

@PragmaTwice
Copy link
Member

please assign to me

Great! Assigned.

zevin02 added a commit to zevin02/incubator-kvrocks that referenced this issue Apr 17, 2023
fixes: apache#1381

- Add a function to get all local IP addresses

Signed-off-by: Zewen Xu <[email protected]>
zevin02 added a commit to zevin02/incubator-kvrocks that referenced this issue Apr 18, 2023
fixes: apache#1381

- Add a function to get all local IP addresses

Signed-off-by: Zewen Xu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement type enhancement good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants