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
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.
来源:https://stackoverflow.com/questions/45053042/apache-geode-cacheserverexception-region-not-found-during-key-set-request