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

The instance runs one of the following MySQL versions and RDS editions:

  • MySQL 8.0 in the High-availability Edition or Enterprise Edition
  • MySQL 5.7 in the High-availability Edition or Enterprise Edition
  • MySQL 5.6
Note If your instance running MySQL 5.7 in the Enterprise Edition does not support read-only instances, submit a ticket.

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 Create Read-Only Instance.
  5. Configure the parameters of the read-only instance.
    Parameter Description
    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. If your database system spans multiple zones, it can provide zone-level disaster recovery.
    Instance Type
    • Entry-level: belongs to the general-purpose instance family. 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 on the same physical host.
    • Enterprise-level: belongs to the dedicated instance family. A dedicated instance occupies exclusive CPU, memory, storage, and I/O resources allocated to it. The top configuration of the dedicated instance family is dedicated host: A dedicated-host instance occupies all CPU, memory, storage, and I/O resources on the physical host where it is housed.
    Note Each instance type supports a specific number of CPU cores, memory capacity, maximum number of connections, and maximum input/output operations per second (IOPS). For more information, see Primary instance types.
    Capacity The storage capacity to store the data files, system files, binary log files, and transaction files of the read-only instance. You can adjust the storage capacity at increments of 5 GB.
    Note The dedicated instance family support exclusive allocations of resources. Therefore, the storage capacity of each instance type with local SSDs in this family is fixed and cannot be adjusted. For more information, see Primary instance types.
  6. Click Next: Instance Configuration and configure the following parameters.
    Parameter Description
    Network Type
    • Classic Network: a traditional type of network.
    • VPC: A VPC is an isolated virtual network with higher security and better performance than a classic network. This is the recommended network type. If you select the VPC network type, you must also specify VPC and VSwitch of Primary Node.
    Note Make sure that the primary RDS instance and the ECS instance you want to connect have the same network type. If both their network types are VPC, you must also make sure that they reside in the same VPC. Otherwise, they cannot communicate over an internal network.
  7. Click Next: Confirm Order.
  8. Read and select Terms of Service and 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.