This topic describes how to create an ApsaraDB RDS for MySQL read-only instance. If the primary instance of your database system is overwhelmed by large amounts of read requests, you can create read-only instances to offload read requests from the primary instance and increase the throughput of your application. Each read-only instance is a replica of the primary instance. The primary instance replicates updates to its data to all read-only instances created in it.

For more information about how to create read-only instances in other database engines, see the following topics:

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

Prerequisites

Your RDS instance runs one of the following MySQL versions and RDS editions:
  • MySQL 8.0 High-availability Edition (with local or enhanced SSDs)
  • MySQL 5.7 High-availability Edition (with local or enhanced SSDs)
  • MySQL 5.6

Precautions

  • You can only create read-only instances in the primary instance. You cannot switch existing instances to read-only instances.
  • While you create a read-only instance, the system replicates data from a secondary instance. Therefore, the operation of the primary instance is not interrupted.
  • A read-only instance does not inherit the parameter settings of the primary instance. The system generates default parameter settings for it. You can only reconfigure the parameters of a read-only instance in the ApsaraDB for RDS console.
  • The maximum number of read-only instances you can create in the primary instance varies depending on the memory capacity.
    Memory capacity Maximum number of read-only instances
    ≥ 64 GB 10
    < 64 GB 5
  • Each read-only instance is charged at an hourly rate by pay-as-you-go billing. The hourly rate varies depending on the instance type at the time of deduction. For more information, visit ApsaraDB RDS for MySQL.

Create a read-only RDS instance

  1. Log on to the ApsaraDB for RDS console.
  2. In the upper-left corner of the page, select the region where the target RDS instance resides.Select a region
  3. Find the target RDS instance and click its ID.
  4. In the Distributed by Instance Role section of the Basic Information page, click Add Read-Only Instance.
  5. Configure the parameters of the read-only instance.
    Parameter Description
    Region

    The geographic location where the read-only instance resides. After the read-only instance is created, its region cannot be changed.

    Zone

    The zone where the read-only instance resides. Each zone is an independent physical area located within a region. There are no substantive differences between zones in the same region. You can deploy RDS and ECS instances in the same zone or in different zones.

    If your database system spans multiple zones, it can provide zone-level disaster recovery.

    Database Engine

    The database engine you want to use for the read-only instance. After the read-only instance is created, its database engine cannot be changed.

    Version

    The version of the database engine you want to use for the read-only instance. After the read-only instance is created, its database engine version cannot be changed.

    Network Type
    • Classic Network: a traditional type of network.
    • VPC: A virtual private cloud (VPC) is an isolated virtual network with higher security and better performance than a classic network. This is the recommended network type.
    CPU and Memory

    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.

    ApsaraDB for RDS provides the following instance families:

    • General-purpose: A general-purpose instance occupies exclusive memory and I/O resources allocated to it, but shares CPU and storage resources with the other general-purpose instances deployed on the same server.
    • Dedicated: A dedicated instance occupies exclusive CPU, memory, storage, and I/O resources allocated to it.
    • Dedicated host: This is the top configuration of the dedicated instance family. A dedicated-host instance occupies all CPU, memory, storage, and I/O resources on the server that houses it.

    For example, "8 Cores, 32 GB" is a general-purpose instance type, "8 Cores, 32 GB (Dedicated)" is a dedicated instance type, and "30 Cores, 220 GB (Dedicated Host)" is a dedicated-host instance type.

    Capacity The storage capacity to store data files, system files, binary log files, and transaction files.
    Quantity The number of read-only instances you want to create.
  6. Click Buy Now, read and select Terms of Service, and then click Pay Now.

The read-only instances are created after a few minutes.

View a read-only instance

To view a read-only instance on the Instances page, follow these steps:

  1. Log on to the ApsaradB for RDS console.
  2. Select the region where the read-only instance resides.Select a region
  3. Find the read-only instance and click its ID.

To view a read-only instance on the Basic Information page of its primary RDS instance, follow these steps:

  1. Log on to the ApsaradB for RDS console.
  2. Select the region where the primary RDS instance resides.Select a region
  3. Find the primary RDS instance and click its ID.
  4. On the Basic information page, move the pointer over the number of read-only instances and click the ID of the read-only instance you want to view.

View the delay of data replication to a read-only instance

A primary RDS instance replicates data to its read-only instances at a certain delay. You can navigate to the Basic Information page of a read-only instance to view the delay of data replication to it.

Related operations

Operation Description
CreateReadOnlyDBInstance Creates a read-only instance for a primary ApsaraDB for RDS instance.

FAQ

  • Will the system automatically upgrade the specifications of read-only instances after I upgrade the specifications of their primary RDS instance?

    No, you must manually upgrade the specifications of read-only instances.

  • Can I access a read-only instance by using a read/write splitting address after I set its read weight to 0?

    No, you can only access a read-only instance by using its own internal or public endpoint after you set its read weight to 0. We recommend that you only set the read weight of a read-only instance to 0 if you want this instance to server only a specific service.