Closed robinroos closed 5 years ago
In our specific case we expect that the Hazelcast nodes will fail to cluster across application names, as their XML config specify different group names.
For a user which did not specify different group names, perhaps because they were using default hazelcast.xml configurations, they would be at risk of having their hazelcast nodes cluster without the intention that they do so.
I believe the issue might lie in the Spotify DockerClient library which provides the Service.Criteria api, or actually in Hazelcast /services which interprets those criteria.
If those external libraries deliberately interpret serviceName criteria as being "beginWith" rather than "equals", then BitsOfInfo may have to add an explicit docker-service-names "contains" test for all services returned by the Criteria api.
Here is confirmation that a cluster node of service "ip-ui" attempted to cluster with another node belonging to a different Hazelcast group:
March 11th 2019, 16:27:44.283 | WARN | com.hazelcast.cluster | [10.0.5.107]:5701 [test-ips-ui-session] [3.11.2] Node could not join cluster at node: [10.0.5.109]:5701 Cause: the target cluster has a different group-name
Group name "test-ips-ui-session" corresponds to the group name of the cache node (for SpringSession) of the service "ip-ui" in the "test" environment.
We call the Spotify docker client library. The Spotify lib calls the docker services API which has this behavior. Hazelcast will of course attempt to connect to whatever peer IPs are yielded by these api calls. For your case the simplest thing would be to just adjust how you name your services as they appear w/ docker service ls
, otherwise fee free to submit a PR that implements some sort of negation capability to filter out the set after all api calls have been made.
Cool, thanks. I will do a PR for this as it will help others and not just me.
I have raised PR #37 to address this.
If your review is approving please publish the same as RC14.
Hello,
At present we have our Docker Swarm scaled at 1, and in each case
docker-service-names
contains ONLY that service's name and no other entries. We therefore expect each service to find itself but not to find any other instances (of its own service name).One of our service names (ip-ui) is, coincidentally, a sub-string of another service name (ip-ui-or).
We observe that, despite the setting:
the SwarmDiscoveryUtil logs having
The log extract was taken from Kibana. Note also that, although the service
ip-ui-or
is ALSO logging to the same Kibana instance, I have filtered the messages to show only those arising fromThe log extract below is in reverse (most recent messages at the top)