All Products
Search
Document Center

ApsaraDB RDS:Create a read-only ApsaraDB RDS for MySQL instance

Last Updated:Aug 29, 2024

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. This indicates that each read-only RDS contains the same data as the primary RDS instance. Data updates on the primary RDS instance are automatically synchronized to each read-only RDS instance.

For more information about how to create a read-only RDS instance that runs a different database engine, see the following topics:

For more information about read-only RDS instances, see Overview of read-only ApsaraDB RDS for MySQL instances.

Prerequisites

The primary RDS instance must meet the following conditions:

  • The RDS instance runs MySQL 8.0, MySQL 5.7, or MySQL 5.6.

  • The RDS instance uses the subscription or pay-as-you-go billing method. Serverless RDS instances do not support read-only RDS instances.

  • The RDS instance runs RDS High-availability Edition or RDS Enterprise Edition.

Note

You can go to the Basic Information page of your RDS instance to obtain the preceding information.

Usage notes

  • You can create read-only RDS instances for the primary RDS instance, but cannot convert existing RDS instances to read-only RDS instances.

  • When a read-only RDS instance is being created, 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.

  • You cannot configure automatic backup policies or manually create backups for a read-only RDS instance because these operations are performed on the primary RDS instance. You can only configure a retention policy for binary log files of the read-only RDS instance. For more information, see Delete the binary log files of an ApsaraDB RDS for MySQL instance.

  • Storage capacity:

    • If the primary RDS instance uses cloud disks, 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 disks, the storage capacity of its read-only RDS instance must be greater than or equal to the storage capacity of the 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 Instance types for read-only ApsaraDB RDS instances.

  • 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.

Procedure

  1. Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.

  2. In the Instance Distribution section of the Basic Information page, click Add to the right of Read-only Instance.

  3. 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 it to reduce costs.

    Edition

    • Basic Edition: Only one read-only RDS instance is created. RDS Basic Edition is a cost-effective database solution that is suitable for learning or testing scenarios. RDS instances that run RDS Basic Edition require a long period of time to restart or recover from faults.

      Note

      This option is available only when the RDS instance uses cloud disks.

    • High-availability Edition (default): One primary read-only RDS instance and one secondary read-only RDS instance are created to achieve high availability. RDS High-availability Edition is suitable for more than 80% of business scenarios that require production environments.

      Note

      If you select this option, you must also configure the Zone of Primary Node, Deployment Method, and Zone of Secondary Node parameters. Valid values of the Deployment Method parameter: Multi-zone Deployment and Single-zone Deployment.

    Product Type

    The YiTian product type is available only when you set the Storage Type parameter to ESSD for the primary RDS instance.

    For more information about the standard and YiTian product types, see Product types.

    Zone of Primary Node or Zone of Secondary Node

    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 Instance Types: A general-purpose RDS instance exclusively occupies the memory and I/O resources that are allocated. However, this type of instance shares CPU and storage resources with other general-purpose instances that are deployed on the same host.

    • Dedicated Instance Types: You can select a dedicated instance type or a dedicated host instance type. A dedicated RDS instance exclusively occupies the CPU, memory, storage, and I/O resources that are allocated. Dedicated host instance types provide the highest specifications in the dedicated instance family. A dedicated host RDS instance exclusively occupies all CPU, memory, storage, and I/O resources on the physical host on which 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 Instance types for standard read-only ApsaraDB RDS for MySQL instances (original x86 architecture).

    Database Proxy

    The general-purpose database proxy feature is provided free of charge and can be enabled on the ApsaraDB RDS buy page or after an ApsaraDB RDS instance is created. The feature supports advanced capabilities such as read/write splitting, persistent connections, transaction splitting, connection pooling, and SSL encryption. The system enables the database proxies of the recommended specifications for your RDS instance. For more information, see Procedure.

    Note
    • By default, the general-purpose database proxy feature is enabled for the primary RDS instance to which the read-only RDS instances are attached. You can manually disable the feature based on your business requirements.

    • You can change the types and the specifications of database proxies after you enable database proxies. For more information, see Change the types and the number of database proxies.

    Storage 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 the primary RDS instance to which the read-only RDS instance is attached.

  4. Click Next: Instance Configuration and configure the following parameters.

    Parameter

    Description

    VPC

    The VPC in which the primary RDS instance resides.

    VSwitch of Primary Node

    The default vSwitch of the primary RDS instance.

    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.

    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.

  5. Click Next: Confirm Order.

  6. 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 the primary RDS instance uses the subscription billing method and you want to change the billing method of its read-only RDS instance from pay-as-you-go to subscription, you cannot select Consistent with Primary Instance in the Duration section. This setting applies only to new read-only RDS instances. We recommend that you release a pay-as-you-go read-only RDS instance and then purchase a subscription read-only 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.

View a read-only RDS instance

View a read-only RDS instance on the Instances page

  1. 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 RDS instance resides.

  2. Find the required 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

  1. 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 RDS instance resides.

  2. Find the required primary RDS instance and click the instance ID.

  3. In the Instance Distribution 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.

Use read-only RDS instances

After you create read-only RDS instances for the primary RDS instance, you can manually configure read/write splitting on the application that connects to the primary RDS instance or enable the database proxy feature to implement automatic read/write splitting. For more information, see What is database proxy, What is read/write splitting, and Enable the database proxy feature.

Note

General-purpose database proxies and persistent connections are free of charge. For more information, see [New features/New specifications] ApsaraDB RDS for MySQL provides general-purpose database proxies and persistent connections free of charge.

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 only a VPC for the read-only 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:

      • If local disks are used, you can select a VPC. The selected VPC can be different from the VPC of the primary RDS instance.

      • If cloud disks are used, you can select only the VPC of the primary RDS instance.

  • When I create a read-only RDS instance, the system 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.

  • Do read-only RDS instances support parallel replication?

    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. You can also upgrade the RDS instance from RDS Basic Edition to RDS Cluster Edition. This way, you can use readable secondary nodes of the RDS cluster to implement read/write splitting. An RDS instance that runs RDS Cluster Edition is referred to as an RDS cluster.

  • Can I change the billing method of my read-only RDS instance?

    Yes, you can change the billing method of your read-only RDS instance. For more information, see Switch an ApsaraDB RDS for SQL Server instance from pay-as-you-go to subscription or Switch an ApsaraDB RDS for SQL Server instance from subscription to pay-as-you-go.

  • Is my primary RDS instance affected if I perform the following operations on a read-only RDS instance of the primary RDS instance: change the specifications, release the instance, or change the billing method?

    No, your primary RDS instance is not affected if you perform the operations.

  • When I create a read-only RDS instance that runs RDS High-availability Edition, can I specify zones for my primary and secondary read-only RDS instances?

    If your primary read-only RDS instance uses cloud disks and runs a minor engine version of 20210430 or later, you can specify zones for the primary and secondary read-only RDS instances. If your primary read-only RDS instance uses local disks and runs a minor engine version of 20210430 or earlier, you cannot specify zones for the primary and secondary read-only RDS instances.

Related operations

Operation

Description

CreateReadOnlyDBInstance

Creates a read-only instance.