Reputation: 9
Recently i am trying to use JGroup to create a cluster so different machines connected to the same cluster are able to exchange messages between one another.
I've tried the simple chat application on my localhost (between 2 java applications) and it works with no issues, i.e. they are able to receive and send messages between one another .
Here is the scenario PC 1 : Consist of a java module ( Receiver ) Server 2 ( Module using jgroup resides in this server ) : Sender
My next step is to move the sender ( creator of the cluster ) to another subnet , but still within the same network as i am able to ping the private ip address from my PC 1. Ideally Server 1 will create the cluster ( being first to join ) and when i fire up the receiver on my local machine, it should join the cluster created by server 1.
There is a firewall sitting between these 2 subnets.
I've tried this using the default JChannel setting, but its not working. Cluster created, but PC1 cannot connect to the cluster, but instead formed its own cluster. They have the same cluster name.
I've did further research, do i have to set up UDP multicast at the server as the sender and as the receiver, TCP unicast into the cluster created in the server? If so, i read i have to configure a protocol stack and in either xml or programmatically, and passed those into JChannel instantiation. With TCPPING for discovery ?
Can anyone shed some light? Secondly since there is a firewall sitting between them, do i need to set up TCPGOSSIP?
Best Regards,
Upvotes: 0
Views: 1362
Reputation: 699
I faced the same problem in my enviroment using mod_cluster and JGroups with apache-camel. To achieve the requirements of integration of two datacenters (subnets) I used JGroups and mod_cluster over TCP instead of default UDP with multicast. With JGroups you need to set up a file that contains the whole configuration of protocol stack including tcpping. Inside the .jar of JGroups you find sample files like tcp.xml and tcp-nio.xml. I lost some time using JGroups 3.4.1 facing problems with tcpping configuration that don't work until I upgrade to version 3.6.13.Final.
If are you using JChannel class just use constructor that receive a String with path to XML file that contains the configuration. Don't forget of crucial parameters
-Djgroups.bind_addr
-Djgroups.tcpping.initial_hosts=NODE1[7800],NODE2[7800]
that are used by TCP configuration. In your case you need also to configure the ports used by JGroups in your firewall.
Hope that helps.
Upvotes: 2