Performing a Switchover
Switch the primary and secondary roles of clusters in a cross-region replication relationship.
Perform a switchover for planned regional migration or maintenance when both clusters and both regions are available. Do not perform a switchover if the primary region is unavailable. A switchover reverses the primary and secondary cluster roles.
Both clusters and both regions must be available, and both clusters must be in the Active state, to perform a switchover.
Before you perform the switchover, stop all application write traffic to the current primary cluster. Verify that the cluster that becomes primary has the required configuration and the correct access control list (ACL) users or permissions for the application.
- On the Clusters list page, select the current secondary cluster. If you need help finding the list page or the cluster, see Listing OCI Cache Clusters.
- On the cluster's details page, select Actions, and then select Switchover.
- Confirm the switchover, and then select Update.
After the operation completes, the former secondary cluster has the Primary role, and the former primary cluster has the Secondary role.
Confirm the following to verify the switchover:
- The former secondary cluster now has the Primary role.
- The former primary cluster now has the Secondary role.
- Both clusters return to the Active state.
- CrossRegionMasterLinkStatus indicates that the replication link is up.
- The application sends write traffic only to the new primary cluster.
Redirect application write traffic to the new primary cluster.
Use the oci redis redis-cluster redis-cluster switchover command with the required parameters to switch the roles of a secondary cluster and a primary cluster. The secondary cluster becomes the new primary, and the original primary becomes the new secondary cluster.
oci redis redis-cluster redis-cluster switchover --redis-cluster-id <redis-cluster_OCID> [OPTIONS]For a complete list of parameters and values for CLI commands, see the CLI Command Reference.
Run the Switchover operation to switch the roles of a secondary cluster and a primary cluster. The secondary cluster becomes the new primary cluster, and the original primary becomes the new secondary cluster.
Switchover is an explicit operation, not a declarative state change. Terraform uses a configuration-to-desired-state model and isn't designed for operations that dynamically change the roles of existing resources, such as promoting a standby cluster to primary.
As a result, the Terraform provider doesn't support switchover. You must perform the switchover outside Terraform by using the OCI CLI or SDK.
After you perform a switchover outside Terraform, Terraform detects drift between the configured primary and secondary clusters and the actual state during the next
terraform planorterraform applyoperation. To resolve the drift, update your Terraform configuration or state to reflect the new roles. This update ensures that subsequent plans are consistent and don't attempt to revert the switchover.