Configuring the Hazelcast datagrid
You can configure how the built-in Hazelcast™ datagrid replicates data within your solution architecture.
Configuring Hazelcast
By default, the Hazelcast node in your Diffusion™ server multicasts to all other Hazelcast nodes in the network.
For security, you should consider defining a VLAN or VPC to prevent unwanted Hazelcast multicast connections.
We recommend that, in a production environment, you disable multicast and explicitly define the nodes in your Hazelcast cluster. This configuration is more secure and removes the risk of nodes in your development environment connecting to the production environment and interfering with the production data.
To define which Hazelcast nodes can communicate with each other, use the hazelcast.xml configuration file.
We recommend you configure Hazelcast as a mesh (where every node can connect to the others), not a chain (where each node only connects to one other).
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd" xmlns="http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <properties> <property name="hazelcast.logging.type">slf4j</property> <property name="hazelcast.phone.home.enabled">false</property> </properties> <network> <join> <multicast enabled="false" /> <tcp-ip enabled="true"> <member>node1.example.com</member> <member>203.0.113.1</member> <member>203.0.113.2:5757</member> <member>203.0.113.3-7</member> </tcp-ip> </join> </network> </hazelcast>This example configuration disables the multicast capability and defines the Hazelcast nodes that can be connected to.
The Hazelcast nodes can be defined by hostname, by IP address, or by IP range. The default port used by Hazelcast is 5701. If you want to connect on a different port, you can specify this when you define the node, using the format host:port.
Ensure that the hazelcast.xml file is on the Diffusion server classpath. For example, by putting the file in the diffusion_installation/etc directory. Restart the Diffusion server to load the configuration.
For more information about using the hazelcast.xml file to configure Hazelcast , see the Hazelcast™ Reference Manual.
Diagnosing problems with Hazelcast
If you enable logging for Hazelcast , you can use the log files to diagnose problems with Hazelcast .
<property name="hazelcast.logging.type">slf4j</property>Ensure that the hazelcast.xml file is on the Diffusion server classpath. For example, by putting the file in the diffusion_installation/etc directory. Restart the Diffusion server to load the configuration.
You can also enable logging by starting the Diffusion server that contains the node with the following parameter -Dhazelcast.logging.type=slf4j
You can enable Java Management Extensions (JMX) for your Hazelcast nodes and use a JMX tool to examine the MBeans.
<property name="hazelcast.jmx">true</property>Ensure that the hazelcast.xml file is on the Diffusion server classpath. For example, by putting the file in the diffusion_installation/etc directory. Restart the Diffusion server to load the configuration.
You can also enable JMX by starting the Diffusion server that contains the node with the following parameter -Dhazelcast.jmx=true
For more information about using Hazelcast , see the Hazelcast™ Reference Manual.