# Instances

SQL Server database services can be deployed on the Tessell portal with the following configurations:

| Instance type                                         | Description                                                                                                                                                                                                                                                                                                                                                                                            |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Single instance database service                      | Database service with one instance in a given region and availability zone.                                                                                                                                                                                                                                                                                                                            |
| Multi-AZ database service                             | Database service with 2 instances, one primary and one sync replica. The instances need to be in the same region but can be within the same or different availability zone as the primary instance. The two instances are always homogeneous in nature (Infra/parameters/storage/IOPS, and so on). All planned operations are performed in rolling mode on these services keeping downtime to minimum. |
| Database service with Disaster Recovery instance (DR) | Disaster Recovery instances are async replica instances that can be added in the same or different region as the primary. Multiple DR instances can be added to a database service. No auto failover support. DR-Drill scenario supported, it is explained in below sections. DR can be added to both single instance and Multi-AZ database services.                                                  |
| Database service with Read Replica                    | Read Replica is an async replica opened in Read only mode. You can use this instance for read-only queries.                                                                                                                                                                                                                                                                                            |

**Supported editions and versions**

| Scenario                                                           | Supported Editions (SQL Server 2016-2022)   | Notes/Restrictions                                                         | Not Supported Editions |
| ------------------------------------------------------------------ | ------------------------------------------- | -------------------------------------------------------------------------- | ---------------------- |
| SI (Single Instance) to HA (High Availability)                     | Enterprise, Standard, Developer, Evaluation | Standard edition: only one synchronous replica; no DR/RR at the same time. | Web, Express           |
| SI with existing DR (Disaster Recovery) or RR (Read Replica) to HA | Enterprise, Developer, Evaluation           | Standard edition with DR/RR is not supported.                              | Standard               |

The Instances tab displays the list of all the configured instances for your database service in the tabular format. Each row displays the details of each instance configured per node. Each column of the table provides following information:

* **Name** - Displays the name of the instance configured as per the node along with the node number. This name is generated automatically in the incremental order as below:
  * default-node-0 for primary,
  * default-node-1 for replica 1, this instance is typically an HA replica, configured for automatic failover.
  * \<instance name>-node-\<digit> for replica 2, digit starts from 0 if it is a new read replica or DR replica and the numbering increases as per the number of nodes configured for your database service.
* **Status** - Displays the status of each instance. The status of the instances can be:

| Status                             | Description                                                                                                                                                                                              | Actions Allowed                                                                                                                                           |
| ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| UP                                 | The database instance is up and running. The connections are allowed when it is in UP status.                                                                                                            | All the actions are allowed: Resize the compute shapes Resize the storage Update the parameter profile Delete the instance if it is a Read Replica or DR. |
| DOWN                               | The database instance is down.                                                                                                                                                                           | Please raise a Tessell support ticket if the instance needs to be revived.                                                                                |
| STOPPED                            | The database instance is not running and it is completely stopped.                                                                                                                                       | Start the service                                                                                                                                         |
| CREATING                           | Database instance provision is triggered and the process of creating is on or a new instance is added to the existing database service.                                                                  | No actions allowed                                                                                                                                        |
| DELETING                           | Database instance delete is triggered and the process of deleting is on or an instance is selected to be deleted from the database service. Only RR/DR instances can be deleted from a database service. | No actions allowed                                                                                                                                        |
| REBUILDING                         | Compute shape or storage resize is triggered for the instance.                                                                                                                                           | No actions allowed                                                                                                                                        |
| REBUILD\_FAILED                    | Compute resize or storage resize was triggered and did not complete.                                                                                                                                     | All actions are allowed                                                                                                                                   |
| PATCHING                           | Available patches are selected to apply for the database service.                                                                                                                                        | No actions allowed                                                                                                                                        |
| PATCH\_FAILED                      | Patching for the database instance has failed for some reason.                                                                                                                                           | All actions are allowed                                                                                                                                   |
| UPDATING\_PARAMETER\_PROFILE       | Parameter profile update is triggered for the instance.                                                                                                                                                  | No actions allowed                                                                                                                                        |
| PARAMETER\_PROFILE\_UPDATE\_FAILED | Parameter profile update failed for some reason.                                                                                                                                                         | All actions are allowed                                                                                                                                   |

* **Role** - Displays the role of your instance. The possible values are Primary, HA Replica (Automatic Failover), RR (Read Replica), and DR (Disaster Recovery). Below the role is the name of the server where your instance is residing.
* **Server** - Displays the server name where the instance is deployed. Clicking the server name takes you to that particular server’s home page in the Servers app.
* **Region/Zone** - Displays the name of the cloud and its region on which your instance is hosted.
* **Parameter Profile** - Displays the name of the parameter profile selected for your instance at the time of provisioning your database service.
* **Compute** - Displays the name of the compute shape selected for your instance at the time of provisioning your database service. You can view the allocated vCPUs and memory for this compute shape below the name.
* **Created** - Displays the date and time at which your instance is created.
* **Storage** - Displays the storage size specified during provisioning your database service. To view the storage provider, throughput, and IOPS, click **See details** below the storage size.
* **Connection Endpoint** - Displays the host name for your instance. To view the Service URL, Host, Port, and Username, click **See Details** below the host name of your instance.
* Using the ellipsis icon, you can create private links for DR and RR nodes separately. You can create, update, or delete this private link.

  > Note: Creation of private links for DR and RR nodes is currently supported for AWS cloud. For Azure cloud, this is a planned feature.

### **Switch over**

Tessell platform provides robust High Availability (HA) and Disaster Recovery (DR) capabilities through its **Switchover** functionality. This feature enables seamless transition of services from a primary instance to a designated HA replica or DR instance, ensuring minimal downtime and uninterrupted service availability.

To manually initiate switchover,

1. Click **Switch over**.\
   A ‘Switch over to an instance’ window pops up with the options to switch. It also displays the list of available replica instances along with its name and status.

   > Note: Switching over to an instance may cause some downtime for the service.
2. Select the replica instance to promote as primary and optionally, you can specify the comments. If an HA replica is chosen as target, the switchover is graceful (planned, synchronized way with no data loss) and a switchback is allowed.
3. Select “I understand the consequences” checkbox and click **Switch**.\
   It submits the switching request.
4. To view the progress, select **Submitting Request** below the service name.\
   After the request is submitted, the Switchover operation starts to promote the replica to primary. After it is completed, the service is again Ready and updates the Tessell metadata.

### **SQL Server DR Drills**

When initiating a switchover to a **DR instance**, Tessell provides two distinct operational paths based on the intent of the switchover:

1. **DR Drill (Graceful Switchover)**

* If the **DR Drill** option is selected during the switchover, the platform attempts a graceful switchover from the current primary to the DR instance.
* This ensures that:
  * All transactions are safely committed.
  * The current primary is demoted in a controlled manner.
  * The DR instance is promoted to primary with full data consistency.
* If graceful switchover is not possible (For example, due to connectivity issues, lag, or replication faults), the platform fails the switchover operation to avoid data inconsistency.
* This mode is typically used for DR testing and compliance drills, with the ability to switch back to the original primary after testing is complete.

2. **Actual Disaster Recovery (Forceful Switchover)**

* If the **DR Drill** option is not selected, the platform assumes this is a real disaster scenario.
* In this case:
  * Tessell forcefully promotes the DR instance to become the new Primary.
  * The original Primary is marked as unrecoverable and is brought down.
  * Tessell automatically triggers a rebuild of the original Primary instance.
* After the rebuild is complete and replication is re-established, customers may choose to switch back to the original Primary as part of recovery workflows.

**Key Capabilities**

| Feature                     | DR Drill Enabled         | DR Drill Disabled (Disaster Mode) |
| --------------------------- | ------------------------ | --------------------------------- |
| Switchover Type             | Graceful                 | Forceful                          |
| Data Consistency Check      | Yes                      | Skipped                           |
| Source Primary Status       | Demoted Cleanly          | Brought Down                      |
| Automatic Rebuild of Source | No (optional switchback) | Yes (required for future use)     |
| Switchback Possible         | Yes (Post-drill)         | Yes (Post-rebuild)                |
| Use Case                    | Testing/Compliance       | Actual Disaster/Failover          |

### **Create Replica**

For any database services, you can add new replicas using the **Create Replica** button on the top right corner. The possible options for adding the replicas are High Availability (HA), Disaster Recovery, and Read Only Replica.

**Prerequisites**:

* You need to open bi-directional communication between the primary and HA/DR/Read Replica subnets at the subnet level for two specific ports:
  * Primary database port (For example, 1433 for SQL Server, or your specific DB port) and Port 1599. This must be for entire CIDR blocks of the subnets.
* NSG (Network Security Group) rules need to be applied at subnet level, not VM level, since VM level NSG is managed by Tessell.

1. Select **High Availability**, **Disaster Recovery** or **Read Only Replica** to add the new node.
2. **For adding a HA node:**\
   The ‘Add High Availability Instance’ window opens.

   1. Specify a name for the HA instance in the **Instance Name** field.\
      Region and VNet are kept the same as the primary node. You cannot change it.
   2. Select an availability zone from the **Availability Zone** dropdown list.
   3. Select an available private subnet from the **Private Subnet** dropdown list.

      The configuration panel displays the HA properties that are incurred from the primary. You cannot change these properties for HA.

      * Compute shape
      * vCPUs
      * Storage
      * Encryption Key
      * IOPS
      * Throughput
   4. Click **Create** to create an HA node.

   Adding the HA Instance automatically initiates the following steps:

   * Pre-conversion validation (validates SI service)
   * Snapshot creation (Takes full DB snapshot)
   * Secondary compute provisioning (Creates secondary VM)
   * Software installation (Installs SQL Server)
   * Primary configuration (enables always on Availability Group)
3. **For adding a DR or RR node:**\
   The ‘Add a DR Instance or Add a RR Instance’ window pops up.\
   Provide the following details to add the new instance:

   1. **Instance Name** - Specify the name for the instance. Instance names must contain only alphanumeric characters.

   2. **Region** - Select any of the available regions from the dropdown list for your instance.

   3. **Availability Zone** - Select any of the availability zones from the dropdown list for your instance.

   4. **VPC** - Select any of the available VPC from the dropdown list for your instance.

   5. **Private Subnet** - Select any of the available private subnets from the dropdown list for your instance.

   6. **Advanced configuration** - Expand to specify storage configuration like IOPS and Throughput.

   > Note: Tessell also supports choosing a different shape for DR/Read Replica instances.

   7. Select **Add Instance** to proceed for adding your Read Replica or DR instance.\
      Adding the Disaster Recovery Replica or Read Replica Instance automatically initiates the following steps:

   * Requests to add the replica is submitted
   * Creates the compute instance(s)
   * Prepares the primary database to add new replica
   * Configures the replica database with primary database information
   * Availability Machine is setup for the new instance

As an alternative method, use the code to add the instance.

1. Use the **Code** button at the top-right corner to view the ‘Code for Add New Instance’ window.
2. On the left-hand side of the window, you can view the API, its type and the payload.
3. On the right-hand side of the window, you can view the code to create instances in various languages like Shell, Python, Go, Java, Javascript, and Powershell that you can run independently.
4. You can copy and download the code using respective buttons.
5. Use the **Close** button to return back to the main window.

**Figure 5 - Instances tab**

![](https://3421475909-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXNKiIctERJykfezXfUU2%2Fuploads%2Fgit-blob-d89c4b17ce5ec3c9de0a7bfc3d8e2c1ada1acfe4%2Finstances.png?alt=media)
