The default discovery mechanism for Hazelcast is multicast.
The process essentially broadcasts out it's presence to the network, and tries to join with whichever processes respond.
This is great for development, zero configuration and you're clustered with another process on your machine or **nearby**.
This is not so great for production, for the same reason, the uncontrolled nature of who you might join with.
But also for more subtle reasons of multicast reach and control.
Multicast is frequently disabled by network teams, totally or partially.
For instance, you may not find a node on a different subnet when multicast can't cross subnets (ie. not **nearby**).
Or you may find a node today, but the network team decides tomorrow to tighten up policies and your cluster won't form at the next restart.
Hence, multicast use in production is not recommended.
Auto-discovery attempts to make this simpler still, trying to guess and so something appropriate if running AWS, Azure, GCP etc
It may guess wrong, and wrong guesses aren't good for production.
It may pick multicast, and as above, multicast isn't good for production.
For coding
config.getNetworkConfig().getJoin().getAutoDetectionConfig().setEnabled(false);
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true).setMembers(List.of("123.456.789.1:5701"));
If you just use the first two lines above, discovery is turned off. This process won't look for others to join,
(but it will allow others to find it). Adding the third line will probe that IP address, and if that's a node in
a 10 node cluster it'll tell you where the others are.
You don't need to list all nodes in the cluster for TCP discovery, as you may have a cluster that expands at peak time
and contracts later. So it's generally sufficient to list 3 nodes, unless you expand or contract by more than that.
So long as you get a response from one node, it'll tell you where all the others are.
If all nodes are down, a full restart, it wouldn't matter how many you listed.
If you're doing a rolling bounce, you'd only do one node at a time.
If you don't want others to join with the process, eg. in an integration test, give the cluster a unique name.
Neill