Как получить доступ к запросу OQL в регионе Gemfire 9.6 в java

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 = "здесь номер порта"; приватная строка user = "userID"; private String password = "password" private String SSH command = "ssh ------" private String commandBah = "bash"; частная строка commandgfish = "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";

person S Akin Sabak    schedule 15.04.2019    source источник


Ответы (1)


Чтобы получить доступ к региону в java, вам нужно создать клиент GemFire. Вот базовый фрагмент Java, который создает клиент GemFire ​​и выполняет запрос:

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

person Dan Smith    schedule 15.04.2019