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

时间:2017-07-12 08:58:38

标签: gemfire geode

我是Geode的新用户,已经根据Geode in 5 minutes启动了默认的locatorserver,然后启动了{{3}运行测试的.Net客户端}

// 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客户端和服务器都在同一台机器上运行。为什么客户端找不到服务器?

由于

1 个答案:

答案 0 :(得分:1)

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

如果您正在使用Cluster Configuration Service,最简单的方法是通过GFSH命令,即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,但您应根据用例选择区域类型。 希望这会有所帮助。