Chapter 8. Configuring Cluster Discovery
Running Data Grid on hosted services requires using discovery mechanisms that are adapted to network constraints that individual cloud providers impose. For instance, Amazon EC2 does not allow UDP multicast.
Data Grid can use the following cloud discovery mechanisms:
-
Generic discovery protocols (
TCPPINGandTCPGOSSIP) -
JGroups PING protocols (
KUBE_PINGandDNS_PING) - Cloud-specific PING protocols
Embedded Data Grid requires cloud provider dependencies.
8.1. TCPPING Copy linkLink copied to clipboard!
TCPPING is a generic JGroups discovery mechanism that uses a static list of IP addresses for cluster members.
To use TCPPING, you must add the list of static IP addresses to the JGroups configuration file for each Data Grid node. However, the drawback to TCPPING is that it does not allow nodes to dynamically join Data Grid clusters.
TCPPING configuration example
Reference
8.2. Gossip Router Copy linkLink copied to clipboard!
Gossip routers provide a centralized location on the network from which your Data Grid cluster can retrieve addresses of other nodes.
You inject the address (IP:PORT) of the Gossip router into Data Grid nodes as follows:
-
Pass the address as a system property to the JVM; for example,
-DGossipRouterAddress="10.10.2.4[12001]". - Reference that system property in the JGroups configuration file.
Gossip router configuration example
Reference
8.3. DNS_PING Copy linkLink copied to clipboard!
JGroups DNS_PING queries DNS servers to discover Data Grid cluster members in Kubernetes environments such as OKD and Red Hat OpenShift.
DNS_PING configuration example
Reference
- JGroups DNS_PING
- DNS for Services and Pods (Kubernetes documentation for adding DNS entries)
8.4. KUBE_PING Copy linkLink copied to clipboard!
JGroups Kube_PING uses a Kubernetes API to discover Data Grid cluster members in environments such as OKD and Red Hat OpenShift.
KUBE_PING configuration example
KUBE_PING configuration requirements
-
Your
KUBE_PINGconfiguration must bind the JGroups stack to theeth0network interface. Docker containers useeth0for communication. -
KUBE_PINGuses environment variables inside containers for configuration. TheKUBERNETES_NAMESPACEenvironment variable must specify a valid namespace. You can either hardcode it or populate it via the Kubernetes Downward API. KUBE_PINGrequires additional privileges on Red Hat OpenShift. Assuming thatoc project -qreturns the current namespace anddefaultis the service account name, you can run:oc policy add-role-to-user view system:serviceaccount:$(oc project -q):default -n $(oc project -q)
$ oc policy add-role-to-user view system:serviceaccount:$(oc project -q):default -n $(oc project -q)Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.5. NATIVE_S3_PING Copy linkLink copied to clipboard!
On Amazon Web Service (AWS), use the S3_PING protocol for discovery.
You can configure JGroups to use shared storage to exchange the details of Data Grid nodes. NATIVE_S3_PING allows Amazon S3 as the shared storage but requires both Amazon S3 and EC2 subscriptions.
NATIVE_S3_PING configuration example
NATIVE_S3_PING dependencies for embedded Data Grid
<dependency>
<groupId>org.jgroups.aws.s3</groupId>
<artifactId>native-s3-ping</artifactId>
<version>${version.jgroups.native_s3_ping}</version>
</dependency>
<dependency>
<groupId>org.jgroups.aws.s3</groupId>
<artifactId>native-s3-ping</artifactId>
<version>${version.jgroups.native_s3_ping}</version>
</dependency>
8.6. JDBC_PING Copy linkLink copied to clipboard!
JDBC_PING uses JDBC connections to shared databases, such as Amazon RDS on EC2, to store information about Data Grid nodes.
Reference
8.7. AZURE_PING Copy linkLink copied to clipboard!
On Microsoft Azure, use a generic discovery protocol or AZURE_PING, which uses shared Azure Blob Storage to store discovery information.
AZURE_PING configuration example
<azure.AZURE_PING storage_account_name="replace this with your account name" storage_access_key="replace this with your access key" container="replace this with your container name" />
<azure.AZURE_PING
storage_account_name="replace this with your account name"
storage_access_key="replace this with your access key"
container="replace this with your container name"
/>
AZURE_PING dependencies for embedded Data Grid
<dependency>
<groupId>org.jgroups.azure</groupId>
<artifactId>jgroups-azure</artifactId>
<version>${version.jgroups.azure}</version>
</dependency>
<dependency>
<groupId>org.jgroups.azure</groupId>
<artifactId>jgroups-azure</artifactId>
<version>${version.jgroups.azure}</version>
</dependency>
8.8. GOOGLE2_PING Copy linkLink copied to clipboard!
On Google Compute Engine (GCE), use a generic discovery protocol or GOOGLE2_PING, which uses Google Cloud Storage (GCS) to store information about the cluster members.
GOOGLE2_PING configuration example
<org.jgroups.protocols.google.GOOGLE_PING2 location="${jgroups.google.bucket_name}" />
<org.jgroups.protocols.google.GOOGLE_PING2 location="${jgroups.google.bucket_name}" />
GOOGLE2_PING dependencies for embedded Data Grid
<dependency>
<groupId>org.jgroups.google</groupId>
<artifactId>jgroups-google</artifactId>
<version>${version.jgroups.google}</version>
</dependency>
<dependency>
<groupId>org.jgroups.google</groupId>
<artifactId>jgroups-google</artifactId>
<version>${version.jgroups.google}</version>
</dependency>