MySQL read-only instances

更新时间: 2026-07-30 17:49:34

If your application has many read requests but few write requests, a single instance might be unable to handle the read load, which can impact your services. To scale your read capacity and reduce pressure on your primary instance, you can create one or more read-only instances. These instances handle high volumes of read requests and increase your application's throughput.

For information about read-only instances for other database engines, see the following documents:

Introduction

A read-only instance is a physical copy of the data from a primary instance. Data updates on the primary instance are automatically synchronized to all associated read-only instances. You can also set up delayed replication for a read-only instance.

For information about other synchronization latency issues with read-only instances, see Causes and solutions for synchronization latency of RDS for MySQL read-only instances.

Prerequisites

The primary RDS for MySQL instance must meet the following requirements:

  • Database version: 8.0, 5.7, or 5.6

  • Billing method: Subscription or pay-as-you-go. Serverless instances do not support the creation of read-only instances.

  • Instance edition: High-availability series

Note
  • You can view this information on the Basic Information page for the instance.

  • You can create read-only instances of the high-availability or basic series. A high-availability read-only instance uses a high availability (HA) architecture that consists of a primary node and a secondary node. For more information, see High-availability series.

Differences between read-only, secondary, and disaster recovery instances

  • A read-only instance is in the same region as the primary instance, but can be in a different zone. A secondary instance is in the same region and zone as the primary instance. A disaster recovery instance is in a different region from the primary instance.

  • You can create up to 10 read-only instances for a primary instance. In contrast, a High-availability series instance has one secondary instance. A disaster recovery instance consists of a primary and a secondary instance located in a different region.

  • A read-only instance can serve read requests after it is created and its read weight is set. Secondary and disaster recovery instances do not serve requests when the primary instance is running.

The following figure shows the topology of read-only, primary, secondary, and disaster recovery instances.

image

Scenarios

  • If a primary instance is overloaded, you can create a read-only instance to forward read requests and reduce the load on the primary instance.

  • If the primary instance is temporarily unavailable due to backups or maintenance, you can forward read requests to a read-only instance to ensure service continuity.

  • For data-intensive tasks such as report analysis, you can use a read-only instance to query and analyze large amounts of data without affecting the services on the primary instance.

  • In read/write splitting scenarios, you can use a read-only instance to prevent read/write lock contention, which improves system performance and throughput.

Billing

Read-only instances support the subscription and pay-as-you-go billing methods. For more information about pricing, see Read-only instance specifications.

Notes

  • When you create a subscription-based read-only instance for a subscription-based primary instance, you can align the expiration date of the read-only instance with that of the primary instance.

  • If the primary instance is locked upon expiration, you can still access the read-only instance, provided that it has not expired. The status of the read-only instance changes to Running (Primary Instance Locked).

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

  • If an RDS for MySQL instance has a shared database proxy enabled, an operation to delete the proxy's read/write splitting endpoint is automatically triggered when the last read-only instance is released. If a client is using this endpoint, service access may fail.

Features

  • Billing method: The pay-as-you-go method offers flexibility, while the subscription method provides lower costs for long-term use.

  • Region and zone: A read-only instance must be in the same region as its primary instance, but can be in a different zone.

  • Specifications: The specifications of a read-only instance can differ from those of the primary instance and can be changed at any time. We recommend that the specifications of the read-only instance are equal to or higher than those of the primary instance. If the specifications are lower, the read-only instance may experience high synchronization latency and heavy loads.

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

  • Storage capacity: The storage capacity of the read-only instance cannot be less than that of the primary instance.

  • Network type: The network type can be different from that of the primary instance.

  • Account and database management: You do not need to manage accounts or databases on a read-only instance. They are synchronized from the primary instance.

  • Whitelist: When a read-only instance is created, it automatically inherits the IP address whitelist of its primary instance. After creation, the whitelists of the read-only instance and the primary instance are independent of each other. To modify the whitelist of the read-only instance, see Configure an IP address whitelist.

  • Monitoring and Alerts: You can monitor nearly 20 system performance metrics, such as disk capacity, IOPS, connections, CPU utilization, and network traffic.

  • Performance optimization (MySQL only): RDS provides various optimization suggestions, such as checks for storage engines, primary keys, large tables, and indexes. You can optimize the database based on these suggestions and the characteristics of your application.

  • Primary/secondary switchover: High-availability read-only instances support primary/secondary node switchovers. You can also view the switchover logs.

Limitations

  • Number of read-only instances: You can create a maximum of 10 read-only instances for a primary instance.

  • Instance backup: Read-only instances do not support automatic backup policies or manual backups because data is backed up on the primary instance. You can only set a local log retention policy for a read-only instance.

  • Instance recovery:

  • Data migration: You cannot migrate data to a read-only instance.

  • Database management: You cannot create or delete databases.

  • Account management: You cannot create or delete accounts, grant permissions to accounts, or change account passwords on a read-only instance.

Create a read-only instance

Create an RDS for MySQL read-only instance

FAQ

  • Can an account created on the primary instance be used on a read-only instance?

    Yes. Accounts created on the primary instance are synchronized to the read-only instance. You cannot manage accounts on the read-only instance. These accounts have read-only permissions on the read-only instance.

  • Can I pause billing for a read-only instance? If I set the read weight to 0, will I stop being charged?

    No. You cannot pause billing for a read-only instance, even if you set its read weight to 0. If you no longer need the read-only instance, release it promptly to stop incurring charges. For more information, see Release or unsubscribe from an instance.

  • If the database proxy service is not enabled, can I configure the read weights for read-only instances?

    No. If the database proxy service is not enabled, you cannot configure read weights for read-only instances. Instead, you can configure different endpoints (the endpoint of the read-only instance or the primary instance) in different applications to implement read/write splitting and load balancing.

  • When should I purchase a high-availability read-only instance?

    If your application has a high volume of read requests, we recommend that you purchase a high-availability read-only instance to ensure the stability of your read services.

  • If my primary instance already has a secondary instance, do I still need to buy a high-availability read-only instance?

    Yes, you may still need one. The secondary instance is for high availability and ensures service availability during a failure. A read-only instance is used for read/write splitting to handle a high volume of read requests. If your application has a high read workload, we recommend that you purchase a high-availability read-only instance.

  • How do I implement read/write splitting for a Basic Edition instance?

    Basic Edition instances do not support the creation of read-only nodes. You must change the instance edition from Basic to High-availability and then create a read-only instance. RDS automatically enables read/write splitting. After the read-only instance is created, you can adjust the read weights.

上一篇: MySQL read-only instances 下一篇: Create a MySQL read-only instance
阿里云首页 云数据库 RDS 相关技术圈