Configuring Hazelcast

Payara Server supports configuring Hazelcast through the Admin Console and asadmin commands. The Hazelcast configuration file can also be directly edited, but will not be covered in depth in this section.

Using a Hazelcast configuration file will cause the settings set via the Admin Console and asadmin commands to be ignored. Any parameters not specified in the configuration file reverting to the Hazelcast defaults, even if they are specified in the Admin Console or domain.xml (Note - the Hazelcast defaults are not necessarily the same as the Payara Hazelcast defaults).

Setting a Hazelcast Configuration File with the Admin Console

To set the Hazelcast configuration from a Hazelcast Configuration file:

  1. Select the instance’s configuration from the page tree and click the Hazelcast button to view the "Hazelcast Configuration" page:

    Payara Server 4.1.2.172 Hazelcast Selection
  2. On the Hazelcast Configuration page, add the path to your Hazelcast Configuration file and click "Save". This path is relative to your domain configuration directory:

    Payara Server 4.1.2.172 Hazelcast Set Configuration File

Setting a Hazelcast Configuration File using asadmin

The set-hazelcast-configuration command can be used to set the configuration file:

asadmin> set-hazelcast-configuration --hazelcastconfigurationfile /path/to/file --enabled=true

As with the admin console, this path is relative to your domain configuration directory.

Configuring Hazelcast with the Admin Console

Navigate to the Hazelcast Configuration page of your instances configuration.

Payara 4.1.2.172 Hazelcast Options

The following configuration options are available here:

Property Description

Enabled

Whether or not Hazelcast is enabled.

Dynamic

Determines if the Hazelcast member embedded in Payara will be restarted to apply any changes made

Override Configuration File

Specifies the Hazelcast configuration file to use. The path specified is relative to the domain config directory.

If you are using a custom GlassFish server configuration for a cluster or standalone instance (e.g. cluster-config), then the Hazelcast configuration file should be placed in the directory with the same name (e.g. <domain-root>/config/cluster-config). This will ensure it is replicated to the node during startup.

Using this option to point to a valid Hazelcast configuration file will cause all other options set to be ignored. Any options unset within the Hazelcast configuration file will be set to the Hazelcast defaults.

Cluster Group Name

Specifies the Hazelcast group name, to be optionally used to help divide clusters into logical, segregated groups (i.e. dev-group, prod-group).

Cluster Group Password

Specifies the password used to access the Hazelcast group.

Start Port

The port to run Hazelcast on. If this port is busy, the port specified will be incremented until a valid port is found.

Multicast Port

The multicast port for communications in the Hazelcast cluster.

Multicast Group

The multicast group for communications in the Hazelcast cluster.

JNDI Name

The JNDI name to bind the Hazelcast instance to.

License Key

Enables Hazelcast Enterprise features.

Lite Cluster Member

If set to true, cluster members with this configuration will be Hazelcast "lite" nodes, meaning they will not store any cache data locally and rely on other cluster members to store data.

Host Aware Partitioning

Whether or not to enable host-aware partitioning for the cluster. Host aware partitioning must be enabled on all members of the cluster (including Payara Micro instances) for this feature to work correctly.

Enter your required values, and click Save. Restarting the domain or instance/cluster is not necessary for any changes made to take effect, provided that "Dynamic" remains set to "true"

Configuring Hazelcast using Asadmin

As noted in the enable Hazelcast section, the set-hazelcast-configuration asadmin command is used to both enable/disable Hazelcast, and to configure it. You can pass the `--help option to the command to see usage instructions and available arguments in your terminal, both of which are listed below:

Option Type Description Default Mandatory

--enabled

Boolean

Enables Hazelcast. If no target is specified, this will enable Hazelcast on the domain configuration (server-config).

If no arguments are specified, defaults to true.

If other options are specified, asadmin will interactively prompt for --enabled.

false

Yes

--target

Config Name

Specifies the instance or cluster to configure.

server-config

No

--dynamic

Boolean

Enable or disable dynamic stopping and starting of the embedded Hazelcast member.

false

No

--hazelcast-configuration-file

-f

File Path

The Hazelcast configuration file to use. This path is relative to the domain config directory, <Payara Installation Directory>/glassfish/domains/<Domain Name>/config/.

Using this option to point to a valid Hazelcast configuration file will cause all other options set to be ignored. Any options unset within the Hazelcast configuration file will be set to the Hazelcast defaults.

hazelcast-config.xml

No

--startport

Port Number

The port to run Hazelcast on. If this port is busy, the port specified will be incremented until a valid port is found.

5900

No

--multicastgroup

-g

Multicast Address

The multicast group for communications in the Hazelcast instance.

224.2.2.3

No

--multicastport

Port Number

The multicast port for communications in the Hazelcast instance.

54327

No

--clustername

Group Name

Specifies the Hazelcast group name, to be optionally used to help divide clusters into logical, segregated groups (i.e. dev-group, prod_group).

No

--clusterpassword

Password

Specifies the password used to access the Hazelcast group.

No

--jndiname

-j

JNDI Name

Specifies the JNDI name to bind the Hazelcast instance to.

--licensekey

-lk

Hazelcast License

Enables Hazelcast Enterprise features.

No

--lite

Boolean

Sets the cluster to lite mode, where it will cluster but not store any cluster data.

false

No

--hostawarepartitioning

Boolean

Whether or not to enable host-aware partitioning for the cluster. Host aware partitioning must be enabled on all members of the cluster (including Payara Micro instances) for this feature to work correctly.

false

No

--help

-?

Displays the help menu.

false

No

The following example demonstrates setting all of the options on a cluster called cluster1:

asadmin> set-hazelcast-configuration --enabled=true --target=cluster1 --dynamic=true -f hazelcast-config.xml --startport=5902 -g 224.2.2.3 --multicastport=6666 --hostAwareParitioning=true -j payara/Hazelcast

results matching ""

    No results matching ""