我是 Geode 新手,并且已经开始默认locator
and server
根据5 分钟内的晶洞 https://cwiki.apache.org/confluence/display/GEODE/Index#Index-Geodein5minutesGeodein5minutes然后是我用来运行测试的 .Net 客户端here https://gemfire-native.docs.pivotal.io/geode/dotnet-caching-api/simple-csharp-example.html
// 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 客户端和服务器都在同一台计算机上运行。为什么客户端找不到服务器?
Thanks
错误消息是说服务器找不到该区域,而不是客户端无法连接到服务器:Region named /exampleRegion was not found during key set request
。你定义了吗exampleRegion
在服务器端?
如果您正在使用集群配置服务 http://geode.apache.org/docs/guide/11/configuring/cluster_config/gfsh_persist.html最简单的方法是通过GFSH http://geode.apache.org/docs/guide/11/tools_modules/gfsh/chapter_overview.html命令,即创建区域 http://geode.apache.org/docs/guide/11/tools_modules/gfsh/command-pages/create.html#topic_54B0985FEC5241CA9D26B0CE0A5EA863: gfsh create region --name=exampleRegion --type=REPLICATE
.
如果您使用单独配置您的成员缓存.xml 文件 http://geode.apache.org/docs/guide/11/reference/topics/chapter_overview_cache_xml.html,区域可以配置如下:
<?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
为简单起见,但您应该根据您的用例选择区域类型。
希望这可以帮助。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)