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

Node chooses wrong hostname #8211

Closed
mosi0815 opened this issue May 18, 2016 · 1 comment
Closed

Node chooses wrong hostname #8211

mosi0815 opened this issue May 18, 2016 · 1 comment
Assignees
Milestone

Comments

@mosi0815
Copy link

@mosi0815 mosi0815 commented May 18, 2016

We have a join configuration like this for Hazelcast 3.6.2:

config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
config.getNetworkConfig().getInterfaces().setInterfaces(interfaces).setEnabled(true);
config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true).setMembers(servers);

The String lists come out of our Spring Boot configuration.
For local development this settings work fine:

hazelcast:
servers:
- 127.0.0.1
interfaces:
- 127.0.0.1

In our production and test enviroment we tried to use this configuration:

hazelcast:
servers:
- appnode1
- appnode2
interfaces:
- "..."

Now every server thinks he is appnode1 because Hazelcast just resolves appnode1 and appnode2 and then matches the interfaces mask onto it. The first match wins. So every node chooses appnode1.

If we disable the interfaces feature everything works as expected. Hazelcast enumerates every ip on the host and matches them against the resolved hostnames.

Shouldn't the whole process work a little bit different? e.g. Find out all IPs of the current host, match them against the interfaces filter strings and compare them to the ips resolved out of the hostnames to determine the nodes hostname?

@tombujok tombujok added the Team: Core label Jul 4, 2016
@mmedenjak mmedenjak added this to the 3.11 milestone Aug 29, 2018
@jerrinot jerrinot self-assigned this Sep 21, 2018
@jerrinot
Copy link
Contributor

@jerrinot jerrinot commented Sep 21, 2018

a local reproducer:

    @Test
    public void testHostnameSelection() {
        Hazelcast.newHazelcastInstance(newConfig());
    }

    private Config newConfig() {
        Config config = new Config();
        NetworkConfig networkConfig = config.getNetworkConfig();

        networkConfig.getJoin().getMulticastConfig().setEnabled(false);
        networkConfig.getJoin().getTcpIpConfig().setMembers(singletonList("example.com")).setEnabled(true);
        networkConfig.getInterfaces().setInterfaces(singleton("*.*.*.*")).setEnabled(true);
        return config;
    }

Hazelcast will pick example.com. Even when example.com resolves to IP address which is obviously not present on my local box.

Members {size:1, ver:1} [
	Member [example.com]:5701 - cf309782-1b0f-49ea-ae6c-cd6f59a0ab1d this
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.