Replicating Data Between Clusters

You can use the WAN Replication feature to automatically replicate data in map or cache data structures from one cluster to another.

Use Cases

WAN Replication supports the following use cases:

  • Set up a disaster recovery strategy, using a failover client. If one cluster fails, the failover client can switch to an alternative cluster with minimal disruption to service.

  • Migrate data to a new cluster before shutting down your original cluster.

Terminology

Term Description

Publisher cluster, also known as the active cluster

Sends or transfers data to another cluster, using WAN Replication

Consumer cluster, also known as the passive cluster

Receives data from another cluster, using WAN Replication

Active-Passive replication

One-way replication. Data updates on a publisher cluster are automatically copied to a consumer cluster. Use this configuration for migrating data between clusters.

Active-Active replication

Uses a pair of publisher clusters for two-way replication. Data updates on either cluster are automatically copied to the other cluster of the pair. Use this configuration with a failover client.

Before you Begin

Set Up WAN Replication

Set up WAN Replication between two clusters.

  1. Sign into the Hazelcast Viridian console and select the cluster that you want to use as a publisher cluster.

    If you want to set up a pair of clusters in an Active-Active configuration, select either cluster.
  2. Go to Manage > WAN Replication and then click + Create New Replication.

    The cluster is set as the Active cluster. Any data updates performed on this cluster are automatically copied to the other cluster of the pair.

  3. Either leave the default options for the following parameters, or update them to suit your use case.

    • Queue Full Behavior: Lets you decide what to do when the replication events queue is full.

      • THROW AN EXCEPTION: Throws a WanReplicationQueueFullException when the queue is full. Processing of replication events stops until action is taken.

      • THROW AN EXCEPTION ONLY IF REPLICATION ACTIVE: As above, but this option is only triggered when both clusters connected by WAN replication are active.

      • NONE: Discards replication events when the queue is full. This option is only suitable for non-critical data.

    • Queue Capacity: Sets the maximum size for the replication events queue. When this limit is reached, the Queue Full Behavior is triggered.

    • Batch Size: Sets the maximum size of replication events that are sent in a single batch.

    • Batch Max Delay Millis: By default, all replication events are delayed by one second (1000 milliseconds) before they are sent to the other cluster of the pair, unless they exceed the Batch Size.

  4. Click Next > to configure the other cluster of the pair.

  5. From the Active/Passive list, select the correct behavior for your second cluster:

    • Passive: Receives only data updates.

    • Active: Sends and receives data updates.

  6. Click Save. WAN Replication is set up.

    If you want to replicate all data between the two clusters immediately, click Sync. This option is useful when you’re migrating data from one cluster to another. Otherwise, WAN Replication is triggered when a data update is made to a publisher cluster.

Verify WAN Replication

Check that data is successfully replicated between two clusters that are connected by WAN Replication.

  1. Connect a client to your publisher cluster and write some data to a map. You can use either cluster in an Active-Active pair.

  2. Open the dashboard of the other cluster and scroll down to Map Metrics. Check the Entry Count chart for new map entries. If you’ve written or synched other data types, check the relevant section of Management Center.

    You can check the status of WAN Replication from Management Center for your publisher cluster. From the dashboard of your cluster select Management Center, then go to Cluster > WAN Replication.

Delete a Cluster that uses WAN Replication

Learn how to delete a cluster that has WAN Replication set up.

Before you start, check that all the data you need has been replicated to another cluster.

To delete a consumer cluster, do the following:

  1. Identify the connected publisher cluster. From the dashboard of the consumer cluster, go to Manage > WAN Replication and look for the ID of publisher cluster.

  2. Open the dashboard of the publisher cluster.

  3. Go to Manage > WAN Replication.

  4. Remove WAN Replication. On the Cluster Settings page, select WAN Replication and then click Delete. Confirm your deletion.

  5. Return to the dashboard of the consumer cluster and delete the cluster.

To delete a publisher cluster, do the following:

  1. Follow steps 2 to 4 as for the consumer cluster.

  2. Go to the dashboard of your publisher cluster and delete the cluster.