Quantcast
Channel: VMware Communities : All Content - vFabric GemFire [ARCHIVED]
Viewing all articles
Browse latest Browse all 990

Connecting to a server using a locator with the native API

$
0
0

I have a program using the native c++ API, and I'm trying to connect it to a server in a different node. When I try this it fails with the message "GemFire Exception: Region::put: not connected to GemFire". I find it strange that it files when it tries to call "put" and not sooner, when "getRegion" is called.

 

Any ideas of what the problem might be? Is there an example covering a scenario like this? All the native client examples I see are prepared to run on a single server and only the "deltas" example seems to be using a locator.

 

Edit: this same example works when I change my client cache.xml to use a server instead of just a locator.

 

This is my setup:

 

Broken code:

PropertiesPtr prptr = Properties::create();

prptr->insert("cache-xml-file", "cacheclient.xml");

CacheFactoryPtr cacheFactory = CacheFactory::createCacheFactory(prptr);

CachePtr cachePtr = cacheFactory->create();     

RegionPtr regionPtr = cachePtr->getRegion("example");

regionPtr->put("foo", "bar");

 

Gemfire servers running:

gfsh> start locator --name=locator1 --port=10101

gfsh> start server --name=server1 --cache-xml-file=tradereader/cacheserver.xml --locators=192.168.1.100[10101]
gfsh>list members

  Name   | Id

-------- | -----------------------------------------------

server1  | HOST2(server1:25333)<v3>:3705

locator1 | HOST1(locator1:24966:locator):19388

 

My server cache.xml:

<?xml version="1.0"?>

<!DOCTYPE cache PUBLIC

  "-//GemStone Systems, Inc.//GemFire Declarative Caching 6.5//EN"

  "http://www.gemstone.com/dtd/cache6_5.dtd">

<cache>

  <cache-server/>

  <region name="example">

    <region-attributes data-policy="replicate"/>

  </region>

</cache>

 

My client cache.xml:

<?xml version="1.0" encoding="utf-8"?>

<client-cache>

  <region name="example" >

      <region-attributes refid="CACHING_PROXY" cloning-enabled="true"

        pool-name="examplePool"/>

    </region>

  <pool name="examplePool"  server-group="ServerGroup1" >

    <locator host="192.168.1.100" port="10101" />

  </pool>

</client-cache>

 

 


Viewing all articles
Browse latest Browse all 990

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>