Domain Data Grid Discovery Modes
The Domain Data Grid has the concept of auto-discovery. When a Payara Server or Payara Micro instance starts it must discover other Data Grid nodes so that it can join the grid. Once an instance has connected to a Payara Instance that is already a member of the grid then it can become a member of the grid.
The following are the discovery mechanisms or modes that are included by default in Payara Server.
The Domain discovery mode is the default discovery mode in Payara Server. In this mode when a Payara Server instance starts it uses information encoded into the
domain.xml describing the node IP Address and ports of the other servers in the domain and the DAS to connect to an existing member of the Data Grid. For a Payara Server instance the first server it will try to connect to is the DAS if that fails it will then try each of the other instances in turn. When the DAS starts it tries to connect to each instance in turn.
The TCP-IP discovery mode is an alternative discovery mode. In this mode the user specifies a comma separated list of IP addresses and ports that a Payara Server instance should try to find members of the data grid at upon boot.
|This discovery mode can be used to build a topology based on single instances of the DAS joining together to create the Data Grid. This is common in container based topologies with no central domain administration server.|
The Multicast discovery mode is an alternative discovery mode. In this mode the user specifies the multicast group and multicast port used to find other members of the Data Grid. When a Payara Server instance configured with multicast discovery starts it broadcasts a message on the multicast group and port to discover other members of the data grid.
|This discovery mode can be used to also build a topology based on single instances of the DAS joining together to create the data grid. In this mode multicast must be supported on the network.|
|This mode is the default mode for Payara Micro|
|Also change the Data Grid group name and password to prevent other instances on the same LAN inadvertently joining your data grid.|
The DNS discovery mode is an alternative discovery mode, closely related to the TCPIP discovery mode. In this mode the user specifies a comma separated list of DNS names and ports that a Payara Server should try to find members of the data grid at upon boot.
The Kubernetes discovery mode is an alternative discovery mode intended for use when running in a Kubernetes environment. In this mode, the user specifies the Kubernetes service name and namespace that Payara Server should look to find other data grid members in - Payara Server will then contact the Kubernetes master upon boot to obtain the list of IP addresses of any other running instances under the specified namespace and service name.
This clustering is done using the Hazelcast Kubernetes plugin, and so you will need to grant Hazelcast permission to query the Kubernetes master node. As per the plugin documentation, you will need to apply the permissions outlined below using
apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: default-cluster roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: view subjects: - kind: ServiceAccount name: default namespace: default
The domain discovery mode can be configured in the administration console under the Data Grid menu option. The discovery mode that is set gets to be applied in a domain-wide manner.
The discovery mode can be set via the asadmin CLI, depending on the specific mode to be selected, by running the following commands
When setting TCPIP mode the list of IP addresses and ports of all Data Grid members must be specified:
asadmin> set-hazelcast-configuration --clustermode tcpip --tcpipmembers 192.168.0.104:4900,192.168.0.105:5900
When setting multicast mode the multicast group and multicast port must be also specified.
If these settings are not specified they will default to
asadmin> set-hazelcast-configuration --clustermode multicast --multicastgroup 220.127.116.11 --multicastport 55000
When setting DNS mode the list of DNS names and ports of all Data Grid members must be specified.
asadmin> set-hazelcast-configuration --clustermode dns --dnsmembers localhost:4900,www.example.com:5900
When setting Kubernetes mode the service name and namespace must be specified using the
--kubernetesnamespace options respectively.
|If a namespace is not specified, Payara Server will use the "default" namespace.|
asadmin> set-hazelcast-configuration --clustermode kubernetes --kubernetesServiceName payara --kubernetesNamespace default