VMware Tanzu GemFire for Kubernetes supports running apps that are within the same Kubernetes cluster as the Tanzu GemFire cluster.

The creation of a Tanzu GemFire cluster causes the creation of a Kubernetes Service and a Kubernetes StatefulSet that is used by an app to connect to the Tanzu GemFire cluster. The app specifies the name of the Kubernetes Service and this stateful set to identify the locators.

The DNS name of each locator follows the form

CLUSTER-NAME-locator-ORDINAL.CLUSTER-NAME-locator.NAMESPACE-NAME

where CLUSTER-NAME appears twice and is the metadata: name field from the deployment YAML. ORDINAL identifies one of the locators, where the numbering starts at 0 and goes up to one fewer than the quantity of locators. NAMESPACE-NAME is your chosen name for the Tanzu GemFire cluster namespace.

As an example, if the Tanzu GemFire cluster's name is gemfire1, and the Tanzu GemFire cluster is within the namespace gemfire-cluster, the first locator's name will be gemfire1-locator-0.gemfire1-locator.gemfire-cluster.

The locator listens on port 10334.

An app must configure at least one locator connect to. Specifying a minimum of two locators is recommended for high availability.

Connect Using the API

This example code fragment specifies the Kubernetes service, creates the client cache, and creates a client region using the API.

The example assumes that the Tanzu GemFire cluster is within the namespace gemfire-cluster, the Tanzu GemFire cluster's name is gemfire1, and that there are at least two locators in the Tanzu GemFire cluster.

ClientCache clientCache = new ClientCacheFactory()
    .set("log-level", "config")
    .addPoolLocator("gemfire1-locator-0.gemfire1-locator.gemfire-cluster", 10334)
    .addPoolLocator("gemfire1-locator-1.gemfire1-locator.gemfire-cluster", 10334)
    .create();

ClientRegionFactory<String,String> regionFactory = clientCache
    .createClientRegionFactory(ClientRegionShortcut.PROXY);
Region<String, String> region = regionFactory.create("DATA");
check-circle-line exclamation-circle-line close-line
Scroll to top icon