在密钥集请求期间找不到 Apache Geode CacheServerException 区域

Apache Geode CacheServerException Region not found during key set request

我是Geode新手,根据Geode in 5 minutes and then the .Net client with which I am running the tests from here

启动了默认的locatorserver
// 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);

当谈到第 4 步时,要将一些条目放入该区域,它给出了错误:

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

.Net 客户端和服务器 运行 在同一台机器上。为什么客户端找不到服务器?

谢谢

错误消息是说服务器找不到区域,而不是客户端无法连接到服务器:Region named /exampleRegion was not found during key set request。您是否在服务器端定义了exampleRegion

如果您使用 Cluster Configuration Service the easiest way to do so is through the GFSH commands, namely create regiongfsh create region --name=exampleRegion --type=REPLICATE

如果您使用 cache.xml file 单独配置您的成员,区域可以配置如下:

<?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>

为了简单起见,我使用 REPLICATE,但您应该根据您的用例选择区域类型。 希望这会有所帮助。