There are many ways to separate clusters
- Depending on where you run, use a small UDP.ip_ttl. E.g. a value of 0 means that multicast doesn't leave the local box
- Use a different cluster name, as you mentioned. This is done in JChannel.connect(cluster_name). The cluster name has to be set in WildFly's configuration
- Use a different UDP.mcast_addr and/or mcast_port
- Bind to a different network interface (bind_addr or -Djgroups.bind_addr)
As far as how to specify the cluster name in your WildFly configuration, this is done via the Infinispan subsystem.
<cache-container name="web"> <transport cluster="cluster-name"/> </cache-container>
When unspecified, the cluster name defaults to the cache container name.
This will change in WF9. JGroups channels will be explicitly defined in the jgroups subsystem, making the task of overriding default cluster names a bit more obvious.
In general, isolating clusters based solely on cluster names is not a good idea, since a node will receive messages from other clusters and have to filter based on name. Instead, as Bela suggested, using unique multicast address/port combinations is the way to go.