Skip to main content
Version: 5.17

Configure WAN replication

WAN replication allows you to keep Hazelcast clusters in sync across multiple sites or cloud deployments. Using Operator, you can create a WanReplication resource to replicate multiple maps from multiple source clusters to a single target Hazelcast cluster.

See WAN replication for more detailed information about the configuration and behavior of WAN replication in Hazelcast.

tip

For a worked example, see the Replicate data between clusters tutorial.

Prerequisites​

Before you create and configure a WanReplication resource, you need to create the following:

  • At least one Hazelcast resource and one Map resource for the source Hazelcast cluster.
  • A target Hazelcast cluster that is accessible from the source cluster.

Configure the WAN replication resource​

You can use the following configuration options in your WanReplication resource. For more detailed information, see the API reference.

FieldDescription
resources

The list of custom Map or Hazelcast resources to which WAN replication applies.

  • name: The name of custom resource to which WAN replication applies.
  • kind: The type of custom resource. Either Map(default) or Hazelcast. Use the Hazelcast type to apply WAN replication to all custom maps created under the given Hazelcast resource. WAN replication will also be started automatically for newly created Map resources.
targetClusterNameThe name of the Hazelcast cluster that is the target of replication.
endpointsA comma-separated list of the addresses of the Hazelcast members in the target cluster.
queue

The configuration of the WAN events queue, which includes two related parameters:

  • capacity: The total capacity of WAN events queue. The fullBehavior is triggered when the number of events exceeds this limit.
  • fullBehavior: What happens to new events that arrive after the events queue is full.
batch

How WAN replication events are batched.

  • size: The maximum batch size.
  • maximumDelay: If the batch size is not reached, the events will be sent after the maximum delay (in milliseconds).
acknowledgement

Configuration of the acknowledgement sent after a batch of replication events is received by the target cluster:

  • type: Whether an acknowledgement is sent as soon as the batch of events is received (ACK_ON_RECEIPT) or after each update is applied to the target cluster (ACK_ON_OPERATION_COMPLETE).
  • timeout: The period of time the source cluster waits for the acknowledgement. If the confirmation is not received before the timeout, the replication events are re-sent.

Example configuration​

The following WanReplication resource creates the WAN replication configuration for the Hazelcast and Map resources on the source Hazelcast cluster.

Example configuration
yaml
apiVersion: hazelcast.com/v1alpha1
kind: WanReplication
metadata:
name: wanreplication-sample
spec:
resources:
- name: map-sample
kind: Map
- name: hz-sample
kind: Hazelcast
targetClusterName: dev
endpoints: "198.51.100.252,198.51.100.255"
queue:
capacity: 10000
fullBehavior: DISCARD_AFTER_MUTATION
batch:
size: 500
maximumDelay: 1000
acknowledgement:
type: ACK_ON_OPERATION_COMPLETE
timeout: 60000
note

If a port number is not specified in the endpoints, the default Hazelcast port '5710' is joined to the endpoints.

Checking the Status of a WAN Replication​

After creating the WanReplication resource, run the following command to find out the WAN replication status:

shell
kubectl get wanreplication wanreplication-sample -o wide

The returned status message will look something like the following:

NAME STATUS MESSAGE
wanreplication-sample Success

You can also monitor the status of WAN replications in Management Center.

Deleting the WanReplication Custom Resource​

Deleting the WanReplication object stops the replication of all maps in the .spec.resources field and clears the queues.