OCI Cache Cross-Region Replication

OCI Cache cross-region replication lets you asynchronously replicate data from a primary cache cluster in one OCI region to a secondary cache cluster in another region. The primary cluster supports both read and write operations. The secondary cluster is read-only and continuously receives updates from the primary cluster.

Use cross-region replication to:

  • Improve disaster recovery readiness.
  • Provide lower-latency reads for globally distributed applications.
  • Support planned workload migration between regions.

You can create or convert a secondary cluster, perform a planned switchover, convert a secondary cluster to standalone for disaster recovery, view replication details, or remove the replication relationship.

To manage cross-region replication, you must have the required permissions on the participating clusters. The required permissions depend on the operation. For more information, see OCI Cache IAM Policies.

Cluster Roles in Cross-Region Replication

An OCI Cache cluster can have one of these roles:

  • Primary: Accepts read and write operations. Sends data changes to the secondary cluster.
  • Secondary: Receives changes from the primary cluster. Accepts read operations only. To accept write operations, the secondary cluster must become primary through a switchover or conversion to standalone.
  • Standalone: Not part of a cross-region replication relationship. Accepts both read and write operations.

How Cross-Region Replication Works

When you establish cross-region replication, OCI Cache securely connects clusters in two different regions and synchronizes the secondary cluster with the primary cluster.

During initial synchronization, the secondary cluster receives a full copy of the data from the primary cluster. After initial synchronization completes, the primary cluster continuously sends subsequent changes to the secondary cluster.

If replication is interrupted, OCI Cache attempts to transfer only the changes that the secondary cluster missed. If the required replication history is no longer available, OCI Cache performs another full synchronization. Full synchronization can temporarily increase memory, CPU, and network usage.

Replication traffic is encrypted in transit and uses private OCI Networking.

Replication Lag and Data Consistency

Replication is asynchronous. Write operations can finish on the primary cluster before OCI Cache applies the changes to the secondary cluster. This delay is called replication lag. Replication lag can vary based on the write rate, dataset size, resource utilization, network latency, and distance between the regions. To review current network latency between OCI regions, see Inter-Region Latency.

If your application reads from the secondary cluster, you must tolerate eventual consistency. During outages, the most recent writes might not be present on the secondary cluster.

Planned Switchover

A switchover reverses the roles of the clusters. The secondary cluster becomes primary, and the primary cluster becomes secondary.

Use a switchover for planned regional migration or maintenance. Both clusters and both regions must be available to perform a switchover.

Stop application writes before you start a switchover to reduce the risk of data loss.

Disaster Recovery

If the primary region is unavailable, you can't use a switchover because both clusters must communicate.

To recover from an outage in the primary region, convert the secondary cluster to standalone. After conversion, update your application to use the new endpoint.

When the original region becomes available, you can set up a new replication relationship.

Considerations for Cross-Region Replication

Review the following considerations before you configure cross-region replication for OCI Cache.

  • Cross-region replication uses an active-passive configuration with one primary cluster and one secondary cluster.
  • Only the primary cluster accepts write operations. The secondary cluster is read-only for replication purposes, and automatic failover is not supported.
  • Cross-region replication is available only in selected OCI regions. For a list of supported regions, see Supported Region Pairs for Cross-Region Replication.
  • The primary and secondary clusters must be in different OCI regions.
  • The primary and secondary clusters must have matching:
    • Cache engine versions
    • Cluster modes
    • Memory per node
  • The memory per node must be at least 8 GB for both the primary and secondary clusters.
  • Cross-region replication supports only non-sharded clusters.
  • The primary and secondary clusters can have different node counts.
  • A secondary cluster can't act as the primary cluster for another replication relationship.
  • Before you establish cross-region replication, both clusters must use custom OCI Cache configuration sets. Use the same values for the following parameters in the primary and secondary configuration sets:
    • reserved-memory-percentage
    • maxmemory-policy
    • databases (only if you set it to a value other than the default value of 16)
  • The reserved-memory-percentage value must be at least 35, and maxmemory-policy can't be set to noeviction.
  • No other configuration parameters require matching for cross-region replication.
  • OCI Cache configurations and ACL users are not copied automatically between primary and secondary clusters. Create the required configuration in both regions.
  • For ACL users, use the same users and permissions on both clusters when possible. This approach simplifies role changes and helps avoid authorization issues after a switchover. You can configure different ACL users if your application requires it. See Supported Configurations for OCI Cache and OCI Cache Users
  • Converting an existing cluster to a secondary cluster deletes the cluster's data.
  • Replication is asynchronous, so reads from the secondary cluster might return stale data.
  • Switchover requires both the primary and secondary clusters to be available.
  • Backups aren't supported for clusters that use cross-region replication.
  • When you resize memory, resize clusters in the following order:
    • To increase memory, resize the secondary cluster before you resize the primary cluster.
    • To decrease memory, resize the primary cluster before you resize the secondary cluster.
  • Inter-region replication incurs network egress charges, depending on region and data volume.