All Products
Search
Document Center

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

Last Updated:Sep 24, 2025

You can create a read-only instance to handle database read requests in high-concurrency scenarios, improve overall system throughput, and enable efficient read/write splitting. A read-only instance is a complete replica of the primary database instance. Any data changes to the primary instance are automatically synchronized to all associated read-only instances. This process reduces the read load on the primary instance and ensures data consistency between the primary and read-only instances.

To create read-only instances for other database engines, see the following topics:

Prerequisites

The primary RDS for MySQL 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.

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

  • You can create read-only RDS instances that run RDS High-availability Edition or RDS Basic Edition. A read-only RDS instance that runs RDS High-availability Edition includes a primary instance and a secondary instance that work in HA mode. For more information, see RDS High-availability Edition.

Notes

  • You can create read-only instances only from a primary instance. You cannot convert an existing instance into a read-only instance.

  • When you create a read-only instance, data is replicated from a secondary instance. Therefore, the primary instance is not affected.

  • After the primary instance is released, subscription read-only instances are automatically refunded and released. Pay-as-you-go read-only instances are directly released.

  • The parameters of a read-only instance do not inherit the parameter settings of the primary instance. Default parameter values are used instead. You can modify these parameters on the console of the read-only instance.

  • The storage class of the read-only instance must be the same as that of the primary instance.

  • Because the primary instance is already backed up, read-only instances support only setting a local log retention policy. You cannot set an automatic backup policy or manually initiate a backup for a read-only instance.

  • Storage capacity:

    • Instances that use cloud disks: The storage capacity of a read-only instance cannot be less than that of the primary instance. If you change the specifications of the primary instance and its memory becomes larger than that of the read-only instance, the read-only instance is restarted.

    • Instances that use local disks: The storage capacity of a read-only instance cannot be less than that of the primary instance.

  • You can create a maximum of 10 read-only instances.

  • Billing method: Subscription or pay-as-you-go. For more information about the fees, see Read-only instance types.

  • The VPCs that you can select when you create a read-only instance are subject to limitations.

Create a read-only instance

  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. On the Basic Information page, in the Instance Distribution section, click Add to the right of Read-only Instance.image

    Note

    If the button to add a read-only instance is not displayed, check whether the instance meets the Prerequisites.

  3. Configure the basic resources for the read-only instance.

    Parameter

    Description

    Billing Method

    • Subscription: Upfront payment is required when you create the instance. This billing method is suitable for long-term use and is more cost-effective than pay-as-you-go. The longer the subscription duration, the higher the discount.

    • Pay-as-you-go: You are charged on an hourly basis. This billing method is suitable for short-term use. You can release the instance immediately after use to save costs.

    Product Series

    • Basic Edition: A single-node read-only instance. It is cost-effective and suitable for learning or testing purposes. Fault recovery and restarts take a long time.

      Note

      This option is available only when the primary instance uses cloud disks for storage.

    • High-availability Edition (Default): Consists of a primary node and a secondary node to provide high availability for the read-only instance. This edition is suitable for production environments and meets the needs of more than 80% of user scenarios.

      Note

      If you select High-availability Edition, you must also configure the primary zone, deployment method (multi-zone or single-zone), and secondary zone.

    Product Type

    The Yitian Edition is available only when the Storage Class of the primary instance is ESSD,

    For more information about the Standard Edition and Yitian Edition, see Product types.

    Zone

    This parameter applies only to read-only instances of the Basic Edition. A zone is an independent physical area within a region. There are no significant differences between zones. Basic Edition instances are single-node and are deployed in a single zone by default.

    • Primary Zone

    • Deployment Method

    • Secondary Zone

    These parameters apply only to read-only instances of the High-availability Edition. A zone is an independent physical area within a region. There are no significant differences between zones. For High-availability Edition instances, you must also select a deployment method:

    • Single-zone Deployment: The primary and secondary nodes are in the same zone. You only need to set the primary zone.

    • Multi-zone Deployment: The primary and secondary nodes are in different zones. This provides cross-zone disaster recovery at no extra charge. You must set the primary and secondary zones.

    Instance Type

    • General-purpose: General-purpose instance types. They have dedicated memory and I/O resources but share CPU and storage resources with other general-purpose instances on the same server.

    • Dedicated: Dedicated or exclusive instance types. Dedicated instances have dedicated CPU, memory, storage, and I/O resources. Exclusive instances are the top-tier dedicated instances that exclusively use all CPU, memory, storage, and I/O resources of an entire server.

    Note

    Each instance type has specific CPU cores, memory, maximum connections, and maximum IOPS.

    Database Proxy

    If the database proxy is not enabled for the primary instance, you can choose to enable the free General-purpose database proxy when you create the read-only instance. The system automatically deploys the proxy based on the recommended specifications and enables the proxy feature for the primary instance. The proxy supports advanced features such as read/write splitting, connection pooling, transaction splitting, persistent connections, and Secure Sockets Layer (SSL) encryption. After you enable the proxy, you can flexibly change the proxy specifications and type or manually disable the database proxy as needed.

    Note
    • If the proxy is already enabled for the primary instance, the proxy feature is enabled for the read-only instance by default. You do not need to enable it manually.

    • You can also enable the database proxy after the read-only instance is created.

    Storage Space

    The storage space includes data space, system file space, log file space, and transaction file space. The minimum increment for adjusting the storage space is 5 GB.

    Note

    The storage space of a read-only instance must be greater than or equal to the storage space of its primary instance.

  4. Click Next: Instance Configuration to configure more instance parameters.

    Parameter

    Description

    VPC

    The VPC is the same as that of the primary instance by default. No configuration is required.

    VSwitch of Primary Node

    You can select a primary vSwitch or use the default one.

    Secondary VSwitch

    A secondary vSwitch is automatically assigned. No configuration is required.

    Database Port

    The default port is 3306. You can change it as needed.

    Instance Release Protection

    This parameter applies only to pay-as-you-go instances. Enable instance release protection to prevent the pay-as-you-go instance from being accidentally released.

    Resource Group

    The resource group is the same as that of the primary instance by default. No configuration is required.

    Instance Name

    A custom description for the instance to help you identify it. This parameter is optional.

    Tag

    If you have many instances, you can add tags to them for categorization and management. This parameter is optional.

  5. Click Next: Confirm Order. Confirm the Parameter Configurations. Select the Quantity and Subscription Duration (for subscription instances only). Then, click Confirm Order and complete the payment.

    Note
    • If the primary instance is a subscription instance, you can select Same As Primary Instance next to Subscription Duration when you purchase a subscription read-only instance. This ensures that the lifecycle of the read-only instance is aligned with the primary instance.

    • If the primary instance is a subscription instance and you change the billing method of a read-only instance from pay-as-you-go to subscription, you cannot select Same As Primary Instance for Subscription Duration. This option is available only when you purchase a new read-only instance. To use this option, you must first release the pay-as-you-go read-only instance and then purchase a new subscription read-only instance.

    • For subscription instances, select Auto-renewal. This saves you from the need to manually renew the instance and prevents service interruptions caused by an expired subscription.

View the read-only instance and its endpoint

  1. Log on to the RDS console. In the navigation pane on the left, click Instances. In the top navigation bar, select a region.

  2. In the instance list, find the primary instance and click the drop-down arrow on the left to view the read-only instances under it.image

    You can also click the primary instance ID to go to its details page. The read-only instances are displayed in the Instance Distribution section on the Basic Information page.image

  3. View the endpoint of the read-only instance: A read-only instance has its own endpoint. You can click the read-only instance ID to go to its details page. In the Network Type section on the Basic Information page, click View Endpoint Details to obtain the endpoint of the read-only instance.image

View the latency of a read-only instance

Data synchronization from the primary instance to a read-only instance may be delayed. You can view the latency on the Basic Information page of the read-only instance. For information about the common causes of and solutions for replication latency, see Causes of and solutions to synchronization latency for a read-only ApsaraDB RDS for MySQL instance.

Configure read/write splitting (use a read-only instance)

After you add a read-only instance, you can manually configure read/write splitting in your application or enable the database proxy to automatically implement read/write splitting for application requests. For more information, see What is a database proxy?, What is read/write splitting?, and Enable a database proxy.

Note

The General-purpose database proxy and persistent connections features are free of charge. For more information, see [New Features/Specifications] RDS for MySQL supports free General-purpose database proxy and free persistent connections.

Best practice for taking a read-only instance offline without service interruption using a database proxy

Assume that one primary RDS instance (Primary Instance A) and two read-only RDS instances (Read-only Instances B and C) are provisioned in your database system to implement read-write splitting. If you want to imperceptibly remove Read-only Instance C, perform the following steps:

  1. Log on to the ApsaraDB RDS console and go to the Instances page. In the top navigation bar, select the region in which Primary Instance A resides. Then, find Primary Instance A and click the instance ID.

  2. In the Connection Topology Management section of the Database Proxy page, click Modify Configuration. image

  3. In the Modify Proxy Endpoint (Terminal) Configuration dialog box, set the read weight of Read-only Instance C that you want to remove to 0.image

  4. On the Monitoring and Alerts page of Read-only Instance C, check the value of the active_session metric for the Session monitoring item and wait the value of the metric to be reduced to 0.

    image

    Note

    You need only to check whether the value of the active_session metric is 0. If the value is not 0 for a long period of time, you can terminate sessions.

  5. Go to the Database Proxy page of Primary Instance A to delete Read-only Instance C from the database proxy endpoint.

FAQ

  • Q: How do I force requests to be routed to the primary database or primary instance?

    A: There are three ways to force requests to be processed by the primary instance:

    • Connect to the internal or public endpoint of the primary instance to send requests directly to it.

    • If the database proxy is enabled but transaction splitting is disabled, you can encapsulate requests within a transaction. Operations within a transaction are sent to the primary instance by default.

    • Use Hint syntax to route requests to the primary instance. For more information, see Hint syntax.

  • Q: What is the synchronization latency of a read-only instance?

    A: Under normal circumstances, synchronization occurs in real time. However, replication latency may occur during large transactions or Data Definition Language (DDL) operations. The actual latency varies based on the specific situation.

  • Q: Does a read-only instance have a separate endpoint? Can I connect to it separately?

    A: Yes, it does. You can obtain the endpoint on the Basic Information page of the read-only instance.

  • Q: Why can't I select a specific zone when I create a read-only instance?

    A: If you cannot select a specific zone, it means that resources are temporarily unavailable in that zone. You can select another zone. This does not affect your use of the read-only instance.

  • Q: Can I select a different VPC for the read-only instance than the primary instance?

    A:

    • If the primary instance is in the classic network, you can select any VPC for the read-only instance.

    • If the primary instance is in a VPC, the options for the read-only instance are as follows:

      • If the storage class is local SSD, you can select any VPC for the read-only instance.

      • If the storage class is cloud disk, the VPC of the read-only instance must be the same as that of the primary instance.

  • Q: Creating a read-only instance involves replicating data from a secondary instance and does not affect the primary instance. What is a secondary instance?

    A: A High-availability Edition instance includes a primary instance and a secondary instance. If the primary instance fails, the system switches over to the secondary instance.

  • Q: If a read-only instance is of the High-availability Edition and has a primary and a secondary instance, how do I set parameters for them?

    A: You need to set parameters only on the primary read-only instance. The secondary read-only instance automatically synchronizes the parameter values. You cannot directly modify the parameters of the secondary read-only instance.

  • Q: Can a read-only instance be converted to a regular instance, for example, as a disaster recovery instance?

    A: No, it cannot.

  • Q: Can I back up data on a read-only instance? Can automatic backups be performed on a read-only instance?

    A: No, you cannot. You do not need to back up the read-only instance because backups are performed on the primary instance. Because snapshot backups are used, there is no performance overhead on the primary instance.

  • Q: Does a read-only instance support parallel replication?

    A: Read-only instances support parallel replication.

  • Q: What is the purge mechanism for transaction logs?

    A: The local logs of RDS for MySQL can be automatically deleted based on rules or manually deleted.

  • Q: How can I determine if replication is normal based on the latency of a read-only instance?

    A: Normally, the latency of a read-only instance is within 1 second. If it exceeds 1 second, it indicates data synchronization latency. In extreme cases, the connection may be disconnected.

  • Q: What are the common causes of replication latency?

    A: For information about the common causes of and solutions for replication latency, see Causes of and solutions to synchronization latency for a read-only ApsaraDB RDS for MySQL instance.

  • Q: Does creating a read-only instance affect the primary instance?

    A: No, it does not. However, during the creation of a read-only instance, you cannot perform operations such as changing the specifications of the primary instance. You must wait until the read-only instance is created. Other aspects of the primary instance are not affected for the following reasons:

    • RDS for MySQL creates read-only instances using cloud disk snapshots, which do not affect the primary instance.

    • The high-availability architecture on physical machines for RDS for MySQL uses existing backups (or creates backups from the secondary database) to create read-only instances. This also does not affect the primary database.

  • Q: Can I add a read-only instance to an RDS for MySQL Basic Edition instance to implement read/write splitting?

    A: No, you cannot. You cannot directly add a read-only instance to an RDS for MySQL Basic Edition instance. However, you can upgrade an RDS for MySQL 8.0 or 5.7 Basic Edition instance to the High-availability Edition, add a read-only instance, and then enable and configure the database proxy to implement read/write splitting. You can also upgrade the Basic Edition instance to the Cluster Edition and use the primary and secondary nodes of the Cluster Edition to implement read/write splitting.

  • Q: Can the billing method of a read-only instance be changed?

    A: Yes, it can. For more information, see Convert a pay-as-you-go instance to a subscription instance or Convert a subscription instance to a pay-as-you-go instance.

  • Q: Does changing the configuration, releasing, or changing the billing method of a read-only instance affect the primary instance?

    A: No, it does not.

  • Q: Can I select primary and secondary zones when creating a High-availability Edition read-only instance?

    A: Yes, you can select primary and secondary zones if the primary instance uses cloud disks and its kernel version is 20210430 or later. You cannot select primary and secondary zones if the primary instance uses local disks or in other cases.

  • Q: How can I estimate the cost of a read-only instance?

    A: Log on to the RDS console and go to the page for creating a read-only instance. Configure parameters such as instance type and storage space based on your business needs. The fee displayed on the page can be used as a reference.

Related API

API

Description

Create a read-only instance

Creates a read-only RDS instance.