This topic describes how to create a read-only ApsaraDB RDS for MySQL instance. Read-only RDS instances help increase the read capability of your database system and the throughput of your application. Each read-only RDS instance is a replica of the primary RDS instance and has the same data as the primary RDS instance. Data updates on the primary RDS instance are automatically synchronized to all read-only RDS instances that are attached to the primary RDS instance.
For more information about how to create a read-only RDS instance that runs a different database engine, see the following topics:
- Create a read-only ApsaraDB RDS for SQL Server instance
- Create a read-only ApsaraDB RDS for PostgreSQL instance
For more information about read-only RDS instances, see Overview of read-only ApsaraDB RDS for MySQL instances.
Prerequisites
Read-only RDS instances that run the following database engines and RDS editions are created:
- MySQL 8.0 on RDS High-availability Edition or RDS Enterprise Edition
- MySQL 5.7 on RDS High-availability Edition or RDS Enterprise Edition
- MySQL 5.6
Usage notes
- You can create read-only RDS instances for the primary RDS instance. You cannot convert existing RDS instances to read-only RDS instances.
- When you create a read-only RDS instance, ApsaraDB RDS replicates data from the secondary RDS instance to the read-only RDS instance. This prevents interruptions to your workloads on the primary RDS instance.
- After the primary RDS instance is released, the subscription read-only RDS instances of the primary RDS instance are automatically refunded and released. The pay-as-you-go read-only RDS instances of the primary RDS instance are directly released.
- A read-only RDS instance does not inherit the parameter settings of the primary RDS instance. ApsaraDB RDS generates default parameter settings for each read-only RDS instance. You can modify the parameter settings of a read-only RDS instance in the ApsaraDB RDS console.
- A read-only RDS instance must use the same storage type as its primary RDS instance.
- Storage capacity:
- If the primary RDS instance uses standard SSDs or enhanced SSDs (ESSDs), the storage capacity of a read-only RDS instance cannot be lower than the storage capacity of its primary RDS instance. In addition, if the memory capacity of the primary RDS instance is greater than the memory capacity of the read-only RDS instance, the read-only RDS instance restarts when you change the specifications of the primary RDS instance.
- If the primary RDS instance uses local SSDs, the storage capacity of a read-only RDS instance cannot be lower than the storage capacity of its primary RDS instance.
- You can create up to 10 read-only RDS instances.
- Read-only RDS instances support the pay-as-you-go and subscription billing methods. For more information about the prices of read-only RDS instances, see Read-only ApsaraDB RDS instance types.
- When you create a read-only RDS instance, you must select a virtual private cloud (VPC) that meets the specified requirements. For more information, see FAQ.
Create a read-only RDS instance
- Access RDS Instances, select a region at the top, and then click the ID of the target RDS instance.
- In the Distributed by Instance Role section of the Basic Information page, click Add to the right of Read-only Instance.
- Configure the following parameters.
Parameter Description Billing Method - Subscription: A subscription instance is an instance for which you pay an upfront fee. For long-term use, the subscription billing method is more cost-effective than the pay-as-you-go billing method. You are offered lower prices for longer subscription durations.
- Pay-As-You-Go: A pay-as-you-go instance is billed per hour based on your actual resource usage. We recommend that you select the pay-as-you-go billing method for short-term use. If you no longer need your pay-as-you-go RDS instance, you can release the RDS instance to reduce costs.
Zone The zone in which you want to create the read-only RDS instance. Each zone is an independent physical location within a region. Zones in the same region do not have substantial differences. Instance Type - General-purpose (Entry-level): allows you to select a general-purpose instance type. A general-purpose RDS instance exclusively occupies the allocated memory and I/O resources, but shares CPU and storage resources with the other general-purpose RDS instances that are deployed on the same server.
- Dedicated (Enterprise-level): allows you to select a dedicated instance type or a dedicated host instance type. A dedicated RDS instance exclusively occupies the allocated CPU, memory, storage, and I/O resources. Dedicated host instance types provide the highest specifications in the dedicated instance family. A dedicated host RDS instance occupies all CPU, memory, storage, and I/O resources on the physical host where the RDS instance is deployed.
Note Each instance type supports a specific number of CPU cores, memory capacity, maximum number of connections, and maximum IOPS. For more information, see Read-only ApsaraDB RDS for MySQL instance types (x86).Capacity The storage capacity of the read-only RDS instance. The storage capacity is used to store data files, system files, archived log files, and transaction files. You can change the storage capacity at a step size of 5 GB. Note The storage capacity of a read-only RDS instance must be greater than or equal to the storage capacity of its primary RDS instance. - Click Next: Instance Configuration and configure the following parameters.
Parameter Description Network Type - Classic Network: the traditional type of network. Some RDS instances do not support the classic network type.
- VPC: the recommended type of network. A VPC is an isolated virtual network that provides higher security and higher performance than the classic network. If you select the VPC network type, you must also configure the VPC and VSwitch of Primary Node parameters.
Note- The network type of the RDS instance must be the same as the network type of the Elastic Compute Service (ECS) instance that you want to connect. If the RDS instance and the ECS instance both reside in VPCs, these instances must reside in the same VPC. If the RDS instance and the ECS instance reside in different VPCs, these instances cannot communicate over an internal network.
- A read-only RDS instance must use the same network type as its primary RDS instance. If the primary RDS instance resides in a VPC, make sure that the read-only RDS instance resides in the same VPC.
Release Protection Specifies whether to enable the release protection feature. The release protection feature is used to prevent a pay-as-you-go RDS instance from being released due to unintended operations. For more information, see Enable or disable the release protection feature for an ApsaraDB RDS for MySQL instance. Note This parameter is available only when the Billing Method parameter is set to Pay-As-You-Go.Resource Group The resource group to which the read-only RDS instance belongs. - Click Next: Confirm Order.
- Confirm the settings in the Parameters section, configure the Purchase Plan and Duration parameters, read and select Terms of Service, click Pay Now, and then complete the payment. You must configure the Duration parameter only when the RDS instance uses the subscription billing method. Note
- If the primary RDS instance uses the subscription billing method and you want to purchase a subscription read-only RDS instance, you can select Consistent with Primary Instance in the Duration section. This ensures that the read-only RDS instance has the same subscription duration as the primary RDS instance.
- If you set the Billing Method parameter to Subscription for the read-only RDS instance, we recommend that you select Auto-Renew Enabled. This frees you from manually renewing the read-only RDS instance on a regular basis and prevents interruptions to your workloads on the read-only RDS instance due to overdue payments.
- If the primary RDS instance supports the database proxy feature, you can select MySQL Dedicated Proxy Service (Paid Service) in the Confirm Order step for the instance. For more information, see What are database proxies?
View a read-only RDS instance
View a read-only RDS instance on the Instances page
- Log on to the ApsaraDB RDS console. In the left-side navigation pane, click Instances. In the top navigation bar, select the region in which the read-only RDS instance resides.
- Find the read-only RDS instance and click the instance ID.
View a read-only RDS instance on the Basic Information page of its primary RDS instance
- Log on to the ApsaraDB RDS console. In the left-side navigation pane, click Instances. In the top navigation bar, select the region in which the primary RDS instance resides.
- Find the primary RDS instance and click the instance ID.
- In the Distributed by Instance Role section of the Basic Information page, move the pointer over the number of read-only RDS instances and click the ID of the read-only RDS instance that you want to view.
View the latency of data replication to a read-only RDS instance
A read-only RDS instance may synchronize data from the primary RDS instance at a specific latency. You can go to the Basic Information page of a read-only RDS instance to view the latency of data replication to the instance.
FAQ
- When I create a read-only RDS instance, why am I unable to select a specific zone?
The zone that you select does not have available resources. In this case, we recommend that you select another zone and try again. This does not affect your read-only RDS instance.
- When I create a read-only RDS instance, can I select a VPC that is different from the VPC of its primary RDS instance?
- If the primary RDS instance resides in the classic network, you can select the classic network or a VPC for the read-only RDS instance. The selected VPC can be different from the VPC of the primary RDS instance.
- If the primary RDS instance resides in a VPC, you can configure the network type for the read-only RDS instance based on the following descriptions:
- You can select the classic network.
- If local SSDs are used, you can select a VPC. The selected VPC can be different from the VPC of the primary RDS instance.
- If standard SSDs or ESSDs are used, you can select only the VPC of the primary RDS instance.
- When I create a read-only RDS instance, ApsaraDB RDS replicates data from the secondary RDS instance to the read-only RDS instance. This prevents interruptions to your workloads on the primary RDS instance. What is a secondary RDS instance?
If you use RDS High-availability Edition, your database system consists of a primary RDS instance and a secondary RDS instance. If the primary RDS instance becomes faulty, your database system fails over to the secondary RDS instance.
- If my read-only RDS instance runs RDS High-availability Edition, how do I configure parameters for the primary and secondary read-only instances?
You need to only configure parameters for the primary read-only instance. The parameter settings of the primary read-only instance are automatically synchronized to the secondary read-only instance. You cannot modify the parameters of a secondary read-only instance.
- Can a read-only RDS instance be converted into a regular RDS instance, such as a disaster recovery RDS instance?
No, a read-only RDS instance cannot be converted into a regular RDS instance.
- Can I back up the data of a read-only RDS instance? Does ApsaraDB RDS support automatic backup of read-only RDS instances?
You do not need to back up read-only RDS instances. Backups are performed on the primary RDS instance. If snapshot backups are used, no performance overhead is caused on the primary RDS instance.
- Does ApsaraDB RDS support parallel replication of read-only RDS instances?
Yes, ApsaraDB RDS supports parallel replication of read-only RDS instances.
- How are transaction logs deleted?
The binary log files of an RDS instance can be automatically or manually deleted based on configured rules. For more information, see Delete the binary log files of an ApsaraDB RDS for MySQL instance.
- How do I determine whether replication is normal based on the latency of data replication for a read-only RDS instance?
In most cases, if the latency of data replication for a read-only RDS instance is less than or equal to 1 second, the data replication is implemented as expected. If the latency of data replication for a read-only RDS instance is greater than 1 second, the data replication is abnormal. In some extreme cases, the data replication may stop due to disconnections.
- What causes a replication latency between a primary RDS instance and a read-only RDS instance?
For more information about the causes and solutions for the latency during data replication between a primary RDS instance and its read-only RDS instances, see What do I do if my read-only ApsaraDB RDS for MySQL instance synchronizes data from its primary instance at a latency?.
- When I create a read-only RDS instance for my primary RDS instance, is the primary RDS instance affected? When you create a read-only RDS instance for your primary RDS instance, you cannot perform operations such as specification changes on your primary RDS instance. After the read-only RDS instance is created, you can perform the operations on your primary RDS instance. You primary RDS instance is not affected in the following cases:
- ApsaraDB RDS for MySQL uses disk snapshots to create read-only RDS instances. Disk snapshots do not affect your primary RDS instance.
- ApsaraDB RDS for MySQL uses physical servers to deliver high availability, and read-only RDS instances are created by using existing backups or backups created from a secondary RDS instance. This does not affect your primary RDS instance.
- Can I create a read-only RDS instance for an RDS instance that runs RDS Basic Edition to implement read/write splitting?
No, you cannot create a read-only RDS instance for an RDS instance that runs RDS Basic Edition. You can upgrade the RDS instance that runs MySQL 5.7 or MySQL 8.0 on RDS Basic Edition to RDS High-availability Edition, create a read-only RDS instance, and then enable and configure the database proxy feature to implement read/write splitting.
- For more information about how to upgrade RDS Basic Edition to RDS High-availability Edition, see Upgrade an ApsaraDB RDS for MySQL instance from Basic Edition to High-availability Edition.
- For more information about how to enable and configure the database proxy feature, see Enable and configure the dedicated proxy feature for an ApsaraDB RDS for MySQL instance.
Related operations
Operation | Description |
---|---|
Create a read-only instance | Creates a read-only instance. |