# Switchover to Disaster Replica

A **Switchover to Disaster Recovery (DR) Replica** allows users to temporarily or permanently switch the primary database instance to the DR replica located in a different Availability Zone. This operation is typically performed for activities such as **DR drills, maintenance, or testing failover procedures**.

The **Tessell Console** provides the capability to perform both:

* **Temporary switchover (DR Drill)**
* **Permanent switchover** to the DR replica.

During a **DR Drill**, the primary database role is temporarily transferred to the DR replica and can later be switched back to the original primary instance.

### Behavior During a DR Drill

When a DR Drill is initiated:

* The primary database is switched to the DR replica.
* Once the DR replica is promoted as the new primary instance, the previous primary instance will continue to run as a replica.
* **Automated snapshots** are temporarily paused during the DR drill.
* **Point-in-Time Recovery (PITR)** backups (transaction logs) continue to run from the new primary instance based on the configured **RPO policy**.
* The Tessell Console displays the notification **“DR Drill in Progress”** next to the status of the DB service in the UI.

After the switchback:

* Automated snapshots resume automatically.
* The **“DR Drill in Progress”** notification disappears from UI once the switchback is complete.

## Switchover for a DR Drill (Temporary)

Follow the steps below to temporarily switch the primary database to the DR replica for a DR drill.

### Steps

1. Sign in to the **Tessell Console**.
2. From the left navigation pane, navigate to **DB Services → My Services**
3. Select the **MySQL DB service** for which the switchover needs to be performed.
4. Open the **Instances** tab.
5. Click **Switch Over** from the right panel menu.
6. Select **Switchover to DR Replica**.
7. Enable the option **Switchover for a DR Drill**.
8. Select the **consent checkbox** to confirm the operation.
9. Click **Switch** to initiate the switchover.

## Switchback After DR Drill

After the DR drill is completed, the service can be switched back to the original primary instance.

### Steps

1. Sign in to the **Tessell Console**.
2. Navigate to **DB Services → My Services**
3. Select the corresponding **MySQL DB service**.
4. Go to the **Instances** tab.
5. Click **Switch Over** from the right panel menu.
6. In the switchover window, select the **consent checkbox** to proceed with the switchback to the original primary instance (eg: default-node-0).
7. A **Service Undergoing DR Drill** confirmation window appears.
8. Select the **consent checkbox** again and click **Proceed** to continue the operation.

After completion:

* The original primary instance is restored to the **primary role**.
* Automated snapshots resume from the original primary instance.
* The **DR Drill in Progress** notification is removed from the UI.

## Permanent Switchover to DR Replica

If the user wants to **permanently promote the DR replica as the new primary instance**, the switchover can be performed without enabling the DR Drill option.

### Behavior During Permanent Switchover

* The current primary instance is shut down.
* The DR replica is promoted as the **new primary instance**.
* The service continues operating from the new primary in the **DR Availability Zone**.
* The Tessell Console displays the service status as **“Degraded”**, and the previous primary instance is marked as **“Down.”**
* **Automated snapshots** and **Point-in-Time Recovery (PITR)** backups (transaction logs) run from the new primary instance based on the configured **RPO policy**.
* Once the DR replica is promoted as the new primary instance, **switching back to the original primary instance is not supported**.

### Steps

1. Sign in to the **Tessell Console**.
2. Navigate to **DB Services → My Services**
3. Select the **MySQL DB service**.
4. Go to the **Instances** tab.
5. Click **Switch Over** from the right panel menu.
6. Choose **Switchover to DR Replica**.
7. Uncheck the option **“Switchover for a DR Drill.”**
8. Select the **consent checkbox** to confirm the operation.
9. Click **Switch** to initiate the switchover.
