This solves my problem 😊
I can easily work around the “same region name”

Thank you Charlie Black and Michael Stolz


Claudiu Balcîza    BSc

Database Architect
Architecte de base de données
Arhitect Baze de Date


From: Charlie Black <[email protected]>
Sent: Friday, April 12, 2019 17:07
To: [email protected]
Subject: Re: can't connect to 2 different locators?

The code to do what you are looking for is:

ClientCache clientCache = new ClientCacheFactory().create();

PoolFactory poolFactory = PoolManager.createFactory();
poolFactory.addLocator("systemALocator1", 10334);
poolFactory.addLocator("systemAlocator2", 10334);
poolFactory.create("systemA");

poolFactory = PoolManager.createFactory();
poolFactory.addLocator("systemBLocator1", 10334);
poolFactory.addLocator("systemBlocator2", 10334);
poolFactory.create("systemB");

Region regionA = 
clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY)
        .setPoolName("systemA")
        .create("regionA");

Region regionB = 
clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY)
        .setPoolName("systemB")

        .create("regionB");

One big gotcha is if systemA and systemB have the same region name the client 
can only be using one systems region.   If you are just using OQL you will be 
fine - just use the pool to query.

https://geode.apache.org/releases/latest/javadoc/org/apache/geode/cache/client/Pool.html#getQueryService--

Charlie



On Fri, Apr 12, 2019 at 4:32 PM Michael Stolz 
<[email protected]<mailto:[email protected]>> wrote:
You will need to establish separate pools for the 2 clusters. Each pool can 
talk to separate locators.

--
Mike Stolz
Principal Engineer, GemFire Product Lead
Mobile: +1-631-835-4771

On Fri, Apr 12, 2019, 6:32 PM Jinmei Liao 
<[email protected]<mailto:[email protected]>> wrote:
I believe multiple caches in one VM are not supported in Geode currently.

On Fri, Apr 12, 2019, 3:23 PM Claudiu Balciza 
<[email protected]<mailto:[email protected]>> wrote:
I have 2 geode hosts (dev and test) and I was trying to sync 2 regions
These 2 hosts are not supposed to communicate between them

But when I try

ClientCache cache1 = new ClientCacheFactory()
    .addPoolLocator("host1.local", 2001)
    .create()

ClientCache cache2 = new ClientCacheFactory()
    .addPoolLocator("host2.local", 2002)
    .create()

The first one works just fine, the second one throws:
Caught: java.lang.IllegalStateException: Existing cache's default pool was not 
compatible

I could work around this by having one cache open at a time but I’d like to 
have them both open
Any ideas?

Claudiu Balcîza    BSc

Database Architect
Architecte de base de données
Arhitect Baze de Date




--
Charlie Black | [email protected]<mailto:[email protected]>

Reply via email to