1

I am new to Geode, and have started the default locator and server according to Geode in 5 minutes and then the .Net client with which I am running the tests from here

// 1. Create a cache
CacheFactory cacheFactory = CacheFactory.CreateCacheFactory();
Cache cache = cacheFactory.Create();

// 2. Create default region attributes using region factory
RegionFactory regionFactory =
    cache.CreateRegionFactory(RegionShortcut.CACHING_PROXY);

// 3. Create a region
IRegion<int, string> region =
    regionFactory.Create<int, string>("exampleRegion");

// 4. Put some entries
region[111] = "Value1";
region[123] = "123";

// 5. Get the entries
string result1 = region[111];
string result2 = region[123];

// 6. Close cache
cache.Close();

// 7. Print result
Console.WriteLine(result1);
Console.WriteLine(result2);

and when it comes to step 4, to put some entries into the region, it's giving out the error:

Apache.Geode.Client.CacheServerException : Region::serverKeys: CacheableString( org.apache.geode.cache.RegionDestroyedException: Server connection from [identity(0.0.0.0(default_GeodeDS:6420:loner):2:GFNative_qxrXVNzVzR6420:default_GeodeDS,connection=1; port=55687]: Region named /exampleRegion was not found during key set request

Both the .Net client and the server are running on the same machine. Why isn't the client finding the server?

Thanks

rupweb
  • 3,052
  • 1
  • 30
  • 57

1 Answers1

2

The error message is saying that the server couldn't find the region, not that the client couldn't connect to the server: Region named /exampleRegion was not found during key set request. Have you defined the exampleRegion on the server side?.

If you're using the Cluster Configuration Service the easiest way to do so is through the GFSH commands, namely create region: gfsh create region --name=exampleRegion --type=REPLICATE.

If you're configuring your members individually using the cache.xml file, the region can be configured as below:

<?xml version="1.0" encoding="UTF-8"?>
<cache
    xmlns="http://geode.apache.org/schema/cache"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://geode.apache.org/schema/cache http://geode.apache.org/schema/cache/cache-1.0.xsd"
    version="1.0">
  <cache-server/>
  <region name="exampleRegion" refid="REPLICATE"/>
</cache>

I'm using REPLICATE for the sake of simplicity, but you should choose the type of region according to your use case. Hope this helps.

rupweb
  • 3,052
  • 1
  • 30
  • 57
Juan Ramos
  • 1,421
  • 1
  • 8
  • 13
  • thanks, so it's an obvious answer. You have to create the region on the server side as well... – rupweb Jul 12 '17 at 09:40
  • sorry for newbie question but how do you start gfsh with the cache.xml ? when I do so (with 3 or 4 regions pre defined) it's not picking it up. – rupweb Jul 12 '17 at 09:51
  • 1
    You actually don't start gfsh with the cache.xml, this file is used to configure server members. You basically need to use [start server --cache-xml-file=value](http://geode.apache.org/docs/guide/11/tools_modules/gfsh/command-pages/start.html#topic_3764EE2DB18B4AE4A625E0354471738A). Cheers. – Juan Ramos Jul 12 '17 at 10:18
  • Hi, I am using SPringBoot2 plus. And trying to use annotation EnableEntityDefinedRegions, but unable to create the region dynamically. Is there an alternative or any other annotation vs gfsh way for Region creation? Please guide. – TuneIt Nov 17 '18 at 21:25