无法从Java连接到远程Geode集群

时间:2019-11-17 02:18:31

标签: java gemfire geode

我使用以下代码连接到远程Geode集群

ClientCache clientCache =
        new ClientCacheFactory().addPoolLocator("www.abc.com", 10334).create();

Region<String, Customer> region = clientCache.getRegion("customers");
System.out.println("region => " + region);

注意: www.abc.com:10334 可从我的机器上访问。

日志显示连接到LocalRegion的区域。

我该怎么做才能连接到远程Geode群集区域?我不想使用Spring数据。

2 个答案:

答案 0 :(得分:0)

您需要确保正在创建PROXYPROXY_CACHE区域。使用类似这样的内容:

clientCache
  .createClientRegionFactory(ClientRegionShortcut.PROXY)
  .create("customers");

答案 1 :(得分:0)

借助以下代码解决了该问题

 ClientCache clientCache =
          new ClientCacheFactory().set("cache-xml-file", "cache.xml").create();
 customerRegion = clientCache.getRegion("customers")