We have 3 clusters (US,EU,AP) each with 2 hosts (one primary, other secondary)
Primary host of each cluster updates the secondary host in the same cluster if there is an update. But clusters do not talk with each other.
We have a single process that needs to update all 3 GemFire caches running on each cluster's primary hosts (which will eventually update secondary hosts GemFire)
cache-cluster-1.xml
<client-cache>
<pool name="clientCachePool" read-timeout="90000" >
<server host="pri1-hostname" port="1111" />
<server host="sec1-hostname" port="1111" />
</pool>
<region>...</region>
<client-cache>
cache-cluster-2.xml
<client-cache>
<pool name="clientCachePool" read-timeout="90000" >
<server host="pri2-hostname" port="1111" />
<server host="sec2-hostname" port="1111" />
</pool>
<region>...</region>
<client-cache>
cache-cluster-3.xml
<client-cache>
<pool name="clientCachePool" read-timeout="90000" >
<server host="pri3-hostname" port="1111" />
<server host="sec3-hostname" port="1111" />
</pool>
<region>...</region>
<client-cache>
If I try to initialize separate ClientCache i get below error - > java.lang.IllegalStateException: A connection to a distributed system already exists in this VM.
ClientCache cc1 = ccf.set("cache-xml-file", "cache-cluster-1.xml").create();
ClientCache cc2 = ccf.set("cache-xml-file", "cache-cluster-2.xml").create();
ClientCache cc3 = ccf.set("cache-xml-file", "cache-cluster-3.xml").create();
how do I publish to these three independent clusters using ClientCache?
Close your cc1 before opening cc2, and close cc2 before opening cc3.
If you really must access data in other clusters, then: - if you need ALL of the data from regions in the other cluster, consider a WAN gateway - if you need only selected data from regions in the other cluster, consider a CQRS design where you have another process running a CQ (continuous query) against the remote cluster and updating your near cluster with the results.