ApsaraDB MyBase for SQL Server Always On is built on SQL Server Always On technology and features a decoupled architecture for compute and storage. By default, it provides a primary instance and a read-only instance. You can add more read-only instances and enable read/write splitting by using a read-only routing endpoint. This offloads read queries to the read-only instances and scales the read capability of your cluster. This topic describes how to use an ApsaraDB MyBase for SQL Server Always On instance.
Benefits
- Scale out read capability You can add more read-only instances to linearly scale out the read performance of your cluster. Because the instance type of read-only instances can differ from that of the primary instance, you can provision read-only instances with higher specifications to achieve higher read performance.Note By default, a single read-only instance does not provide high availability. To achieve high availability, you must create at least two read-only instances.
- Flexible cost control
The general-purpose instance types available for read-only instances are highly cost-effective. You can add more read-only instances to offload read queries and optimize your system configuration. You can also provision read-only instances with lower specifications than the primary instance for background tasks, such as business intelligence (BI) and analytics, to reduce costs.
Use cases
- Offload read traffic during peak hours
For example, in the new retail industry, you can handle traffic spikes during promotional events by adding high-specification read-only instances. By implementing read/write splitting and traffic control at the application layer, you can direct major read workloads to these instances, to support traffic volumes several times higher than normal.
- Isolate analytical workloads
Enterprises often need to run data analytics. You can use a dedicated read-only instance for these tasks. This approach isolates analytical queries from your core transactional workload, which reduces blocking on the primary instance, improves concurrency, and ensures the stability of your main business operations.
Prerequisites
You have created an ApsaraDB MyBase dedicated cluster for SQL Server. For more information, see Create an ApsaraDB MyBase dedicated cluster for SQL Server.
You have created hosts for SQL Server in the dedicated cluster. For more information, see Add hosts for SQL Server.
Create a dedicated cluster for SQL Server
Procedure
- Log on to the ApsaraDB MyBase console.
- In the upper-left corner of the page, select a region.
- On the Dedicated Clusters page, click Create Dedicated Cluster.
- On the Create Dedicated Cluster page, configure the following parameters.
Parameter Description Engine The database engine for the dedicated cluster. Select SQL Server.
Dedicated Cluster Name The name of the dedicated cluster. VPC The VPC to which the dedicated cluster belongs. To create a VPC, go to the VPC console. Note You cannot change the VPC after the dedicated cluster is created. To use a different VPC, you must delete the cluster and create a new one. Ensure that you select the correct VPC.Resource Allocation Policy The default allocation policy for database instances in the dedicated cluster: - Balanced Allocation: Prioritizes system stability by allocating instances to hosts with the most available resources.
- Compact Allocation: Maximizes resource utilization by allocating instances to the most utilized hosts that still have capacity.
Grant OS Permissions Specifies whether to grant operating system (OS) permissions for the hosts. Note ApsaraDB MyBase for SQL Server provides OS permissions, which allow you to log on to hosts to upload, download, or install software. This setting cannot be changed after the cluster is created. Select this option with caution. - This step is required only if you are creating an ApsaraDB MyBase dedicated cluster for the first time.
When you create an ApsaraDB MyBase dedicated cluster for the first time, a message appears at the bottom of the page that prompts you to authorize access to ECS elastic network interfaces (ENIs) and security groups. Click Authorize Now, and then click Confirm Authorization Policy on the authorization page.
Note After authorization, a role named AliyunRDSDedicatedHostGroupRole is created and appears on the RAM Roles page of the Resource Access Management (RAM) console. Do not delete this role while you use ApsaraDB MyBase. If you delete it, you must grant the permissions again before you can create another dedicated cluster. - Click OK.
Add hosts for SQL Server
To create an ApsaraDB MyBase for SQL Server Always On instance, you must create at least two hosts that use the same storage type.
Procedure
- In the Actions column of the target dedicated cluster, click Details.
- In the left-side navigation pane, click Hosts, and then click Add Host.
In the left-side navigation pane, you can find tabs such as Overview, Hosts, and Instances. The main area on the right displays the list of hosts. The Add Host button is in the upper-right corner of the page.
- Configure the following parameters.
Parameter Description Product Type Select Dedicated Cluster Host. Note When you purchase a host that uses cloud disks, the fee covers only compute resources. You must pay separately for storage when you create an instance. A storage package is a prepaid resource plan that can be used to offset Pay-As-You-Go storage fees in the same region. You can purchase a storage package to reduce storage costs.Region The region where the host resides. This must be the same as the region of the dedicated cluster. Dedicated Cluster The dedicated cluster to which the host belongs. Zone The zone where the host resides. We recommend that you distribute hosts across different zones for high availability. Host Image The OS image of the host. Select Windows (includes SQL Server Enterprise Edition [Always On] license). Storage Type The storage type of the host. The supported types are ESSD, ESSD PL2, ESSD PL3, and standard SSD. Host Instance Type The specifications of the host, such as its vCPUs and memory. Network Type Select VPC. vSwitch The vSwitch to which the host belongs. If no vSwitches are available, create one as prompted. Quantity The number of hosts to add. For more information, see Host quantity requirements. Duration The subscription period for the host. You can select Auto-renewal to prevent service interruptions from an expired subscription. The host is automatically renewed for the same duration as the initial subscription period. For example, if you purchase a 3-month subscription, the renewal period is also 3 months. - Click Buy Now, agree to the terms of service, and then click Pay to complete the payment.
Create an SQL Server Always On instance
Procedure
- In the Actions column of the target dedicated cluster, click Details.
- In the left-side navigation pane, click Instances, and then click Create Instance.
The page layout is the same as in the Add Host procedure. After you select the Instances tab, the list of instances is displayed on the right. The Create Instance button is in the upper-right corner of the page.
- Configure the following parameters:
Parameter Description Database Engine The database engine of the instance. This is preset to SQL Server and cannot be changed. Current Version The database engine version of the instance. Select SQL Server 2019 EE Always On or SQL Server 2017 EE Always On. Edition The instance edition. This is preset to Always On. Storage Type Select the storage type for the instance. Instance Type The specifications of the instance, such as its vCPUs and memory. Storage Capacity The amount of storage for the instance. Deployment Method The deployment method. Default Policy and Specified Host are supported. Note- Default Policy: This policy deploys the instance to the host with the most available resources.
- Specified Host: You must manually select a primary host and a secondary host.
- The primary instance is deployed as the primary node on the primary host.
- The read-only instance is deployed as the secondary node on the secondary host.
vSwitch The vSwitch to which the instance will be connected. Note This parameter is available only when Deployment Method is set to Default Policy.Billing Method Pay-As-You-Go (postpaid). Note If the instance is deployed on a host that uses cloud disks, the host fee covers only compute resources. You must pay separately for storage when you create the instance. A storage package is a prepaid resource plan that can be used to offset Pay-As-You-Go storage fees in the same region. You can purchase a storage package to reduce storage costs. - Click Create Now.