GemFire 7 and later
With GemFire it is possible to have one client that connects to and works with regions located in different clusters. There are unsupported configurations that should not be used. The purpose of this article is to explain how the client should be configured in this scenario.
It is important to stress that multiple locators for different distributed systems using one pool are not tested or supported. To connect a client to two distributed systems it will need to configure two pools and use different region names in each distributed system that the client connects too. If a client needs to connect to regions with the same name in two different distributed systems then it must close or destroy the region and recreate it with the changed pool configuration each time it wants to change between two distributed systems. If the regions used have different names the client can work with regions from different cluster at the same time.
The following shows a simple client-cache.xml configuration where regions have unique names overall.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE client-cache PUBLIC "-//GemStone Systems, Inc.//GemFire Declarative Cache 7.0//EN" "http://www.gemstone.com/dtd/cache7_0.dtd">
<locator port="40001" host="C1H1"/>
<locator port="40001" host="C2H1"/>
<region-attributes refid="PROXY" pool-name="CLUSTER1"/>
<region-attributes refid="PROXY" pool-name="CLUSTER2"/>
Using this configuration it is possible to work with Region1C1 and Region1C2 without noticing that they are located in different distributed systems.
In the case that you need to work with two regions located in two different distributed systems and these two regions have the same name you will either need to use two different cache.xml files or do the setup dynamically in the code. The important thing to remember is to not work with the two regions simultaneously as previously described in this article.