I have many wildfly-8.2 nodes that has IP address 10.4.0.X. I need to group them in 2 different clusters. Unfortunately I received message from nodes that doesn't included in a cluster. Each cluster receives messages from all nodes since they are all under 10.4.0. Here is my mod_cluster configuration in Apache:
# MOD_CLUSTER_ADDS
<IfModule manager_module>
Listen 10.4.0.1:10001
ManagerBalancerName testbalancer
<VirtualHost 10.4.0.1:10001>
<Location />
Order deny,allow
Deny from all
Allow from 10.4.0.
</Location>
KeepAliveTimeout 300
MaxKeepAliveRequests 0
#ServerAdvertise on http://10.4.0.1:10001
AdvertiseFrequency 5
#AdvertiseSecurityKey secret
#AdvertiseGroup 224.0.1.105:23364
EnableMCPMReceive
<Location /mod_cluster_manager>
SetHandler mod_cluster-manager
Order deny,allow
Deny from all
Allow from 10.4.0
</Location>
I think this might be a good scenario to use widlfly in domain mode, that way you can configure multiple server groups (subclusters) and manage them centrally using a domain controller. A detailed tutorial is available here: http://blog.akquinet.de/2012/07/19/scalable-ha-clustering-with-jboss-as-7-eap-6/
The tutorial splits multiple server groups into multiple load balancer groups on mod_cluster.
To just configure individual nodes into different load balancer groups for mod_cluster (have not tried this myself!), you can use the lbgroup parameter in the mod-cluster-config:
<subsystem xmlns="urn:jboss:domain:modcluster:1.1">
<mod-cluster-config advertise-socket="modcluster"
balancer="myBalancer" load-balancing-group="myLBGroup"
connector="ajp">
<dynamic-load-provider>
<load-metric type="busyness"/>
</dynamic-load-provider>
</mod-cluster-config>
</subsystem>
ref: https://developer.jboss.org/thread/203907
To actually separate the wildfly instances into separate clusters is another story. There used to be a property "jboss.partition.name" but this has been replaced by defining unique multicast address/port combinations for your cluster partitions within the subnet.
https://developer.jboss.org/thread/177877
So assuming you are using udp as your jgroups stack, you can change the multicast address using the "-u" command line parameter:
An alternative for configuring mod_cluster might be to disable advertising (nodes and mod_cluster) and use a static config in your standalone.xml:
<mod-cluster-config proxy-list="10.0.1.2:6667"/>
That way, the nodes will no longer advertise and the assignments to the different mod_cluster apache proxies would be static.