0
I am using Gemfire pivotal for the first time and I need someone who can help me with below question. The Gemfire Pivotal 9.6 is installed on Unix server and I am able to connect to Unix with no issue. I am inside unix now, but I can't access Gemfire. 

Q. How to Access OQL Query on a Gemfire 9.6 Region in java.

这就是我连接到 Unix 的方式。

private String host = "这里的主机名"; private String port = "这里的端口号"; 私人字符串用户=“用户ID”;私有字符串密码 = "密码" 私有字符串 SSH 命令 = "ssh ------" 私有字符串命令Bah = "bash"; 私有字符串命令gfish =“sh /data/gemfire9.6/pivotal-gemfire-9.6.0/bin/gfsh”;

        This is the way I am trying to connect to Gemfire which is not working properly now.



// Gemfire Connection URL, username and password 
            private String connect To Gemfire = "connect --locator=--------";
            private String username = "credential";--
            private String command Pass = "password"
            private String comman Setvariable  = "set variable --name=APP_RESULT_VIEWER --value=EXTERNAL";
4

1 回答 1

0

要在 java 中访问一个区域,您需要创建一个 GemFire 客户端。这是一个创建 GemFire 客户端并执行查询的基本 java 片段:

ClientCache cache = new ClientCacheFactory()
      .addPoolLocator(locator_host, 10334)
      .create()
cache.getQueryService().newQuery("select count(*) from /region").execute()

有关更完整的示例,您可以查看 geode 示例项目(GemFire 基于 Geode)。这是从客户端查询的示例:https ://github.com/apache/geode-examples/tree/master/indexes

于 2019-04-15T17:40:13.927 回答