This topic describes how to create a read-only RDS instance for a primary ApsaraDB RDS for PostgreSQL instance. Read-only RDS instances are used to process a large number of read requests. You can increase the read capability of your database system and the throughput of your application by adding read-only RDS instances to your database system. Each read-only RDS instance is a replica of the primary RDS instance and has the same data as the primary RDS instance. Data updates on the primary RDS instance are automatically synchronized to all read-only RDS instances that are attached to the primary RDS instance.

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

Prerequisites

  • The primary RDS instance runs PostgreSQL 10, PostgreSQL 11, PostgreSQL 12, PostgreSQL 13, or PostgreSQL 14.
  • If the primary RDS instance uses local SSDs, it must be a dedicated RDS instance that provides at least 8 cores and 32 GB of memory.
  • The primary RDS instance runs RDS High-availability Edition. Before you create a read-only RDS instance, you must view the RDS edition of the primary RDS instance on the Basic Information page of the primary RDS instance in the ApsaraDB RDS console. If the primary RDS instance runs RDS Basic Edition, you can click Change Specifications on the page to upgrade the RDS edition of the primary RDS instance to High-availability Edition before you create a read-only RDS instance. For more information, see Change the specifications of an ApsaraDB RDS for PostgreSQL instance.

Precautions

  • You can create only read-only RDS instances that belong to the same instance family as the primary RDS instance. For example, if the primary RDS instance belongs to a general-purpose instance family, you can create only read-only RDS instances of the general-purpose instance family. For more information, see Primary ApsaraDB RDS for PostgreSQL instance types and Read-only ApsaraDB RDS for PostgreSQL instance types.
  • You can create read-only RDS instances for the primary RDS instance. You cannot convert existing RDS instances to read-only RDS instances.
  • When you create a read-only RDS instance, 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.
  • A read-only RDS instance does not inherit the parameter settings of the primary RDS instance. Default parameter settings are generated for the read-only RDS instance. You can modify the default parameter settings in the ApsaraDB RDS console.
    Notice Read-only RDS instances that are attached to the primary RDS instance of a new general-purpose instance type inherit the parameter settings of the primary RDS instance. For more information about read-only RDS instances that use new general-purpose instance types, see Read-only ApsaraDB RDS for PostgreSQL instances with the new general-purpose instance types.
  • If the primary RDS instance uses local SSDs, the specifications and storage capacity of its read-only RDS instances cannot be lower than the specifications and storage capacity of the primary RDS instance.
  • If the primary RDS instance uses standard SSDs or enhanced SSDs (ESSDs), we recommend that you make sure the specifications of its read-only RDS instances are the same as the specifications of the primary RDS instance or are higher than or equal to 50% of the specifications of the primary RDS instance. This helps prevent replication latency and out of memory (OOM) errors that are caused by a significant performance difference between the primary RDS instance and its read-only RDS instances.
  • If the primary RDS instance uses local SSDs, you can create up to 5 read-only RDS instances. If the primary RDS instance uses standard SSDs or ESSDs, you can create up to 32 read-only RDS instances.
  • If the primary RDS instance uses local SSDs, its read-only RDS instances run based on a high-availability architecture. If the primary RDS instance uses standard SSDs or ESSDs, its read-only RDS instances run based on a single-node architecture.
    Note In the single-node architecture, a read-only RDS instance does not have a secondary RDS instance as a standby. For availability purposes, we recommend that you purchase multiple read-only RDS instances. You can use the libpq or Java Database Connectivity (JDBC) API to implement failovers among the read-only RDS instances that you create. For more information, see Configure automatic failover and read/write splitting.
  • You are charged for the read-only RDS instances that you create based on the subscription billing method or the pay-as-you-go billing method. For more information about the fee for a subscription read-only RDS instance, visit the ApsaraDB RDS buy page. For more information about the fee for a pay-as-you-go read-only RDS instance, see Read-only ApsaraDB RDS instance types.

Create a read-only RDS instance

  1. Access RDS Instances, select a region at the top, and then click the ID of the target RDS instance.
  2. In the Distributed by Instance Role section of the page that appears, click Add to the right of Read-only Instance.
    Note If you are using the original ApsaraDB RDS console, click Create Read-only Instance in the Distributed by Instance Role section of the Basic Information page.
    Create a read-only RDS instance
  3. Configure the following parameters.
    Parameter Description
    Billing Method
    • Subscription: A subscription instance is an instance for which you pay an upfront fee. If you want to use the read-only RDS instance for a long period of time, we recommend that you select the subscription billing method. If you select the subscription billing method, you must specify a subscription period.
    • Pay-As-You-Go: A pay-as-you-go instance is an instance for which you are charged per hour based on your resource usage. If you want to use the read-only RDS instance for a short period of time, we recommend that you select the pay-as-you-go billing method. You can create a pay-as-you-go read-only RDS instance. After you confirm that the created read-only RDS instance meets your business requirements, you can change the billing method of the read-only RDS instance from pay-as-you-go to subscription.
    Zone The zone to which the read-only RDS instance belongs. Each zone is an independent physical location within a region. Zones in the same region do not have substantial differences. The multi-zone deployment method supports zone-disaster recovery.
    Instance Type
    • General-purpose (Entry-level): allows you to select a general-purpose instance type. A general-purpose instance exclusively occupies the allocated memory and I/O resources. However, it shares CPU and storage resources with other general-purpose instances that are deployed on the same host.
    • Dedicated (Enterprise-level): allows you to select a dedicated instance type or a dedicated host instance type. A dedicated RDS instance exclusively occupies the allocated CPU, memory, storage, and I/O resources. Dedicated host instance types provide the highest specifications in the dedicated instance family. A dedicated host instance exclusively occupies all the CPU, memory, storage, and I/O resources on the host on which the instance is deployed.
    Note Each instance type supports a specific number of cores, memory capacity, maximum number of connections, and maximum IOPS. For more information, see Read-only ApsaraDB RDS for PostgreSQL instance types.
    Capacity The maximum amount of storage that is provisioned to store data files, system files, WAL files, and transaction files in the read-only RDS instance. You can adjust the storage capacity at a step size of 5 GB.
    Note A dedicated RDS instance that uses local SSDs exclusively occupies the allocated resources, and its storage capacity varies based on the instance type. For more information, see Read-only ApsaraDB RDS for PostgreSQL instance types.
  4. Click Next: Instance Configuration and configure the following parameters.
    Parameter Description
    Network Type
    • Classic Network: the traditional type of network.
    • VPC: the recommended type of network. A virtual private cloud (VPC) is an isolated virtual network that provides higher security and higher performance than the classic network. If you select the VPC network type, you must configure the VPC and VSwitch of Primary Node parameters. If you set the Deployment Method parameter to Multi-zone deployment in the previous step, you must also configure the VSwitch of Secondary Node parameter.
    Note The network type of the RDS instance must be the same as the network type of the Elastic Compute Service (ECS) instance that you want to connect. If both the RDS instance and the ECS instance reside in VPCs, these instances must reside in the same VPC. If the RDS instance and the ECS instance reside in different VPCs, these instances cannot communicate over an internal network.
  5. Click Next: Confirm Order.
  6. Read and select Terms of Service, click Pay Now, and then complete the payment.
The amount of time that is required to create a read-only RDS instance varies based on the storage type and storage capacity of the primary RDS instance. When a read-only RDS instance is being created, your workloads on the primary RDS instance are not affected.
  • If the primary RDS instance uses local SSDs, the amount of time that is required to create a read-only RDS instance is approximately 10 minutes plus the amount of time that is required for a full backup.
  • If the primary RDS instance uses standard SSDs, the amount of time that is required to create a read-only RDS instance is approximately 20 minutes plus the amount of time that is required for a full backup.
  • If the primary RDS instance uses ESSDs, the amount of time required to create a read-only RDS instance is approximately 20 minutes.

View a read-only RDS instance

  • To view a read-only RDS instance on the Instances page, perform the following steps:
    1. Log on to the ApsaraDB RDS console. In the left-side navigation pane, click Instances. In the top navigation bar, select the region where the RDS instance resides.
    2. Find the read-only RDS instance and click the instance ID.
  • To view a read-only RDS instance on the Basic Information page of the primary RDS instance, perform the following steps:
    1. Access RDS Instances, select a region at the top, and then click the ID of the target RDS instance.
    2. On the Basic Information page of the primary RDS instance, 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. Go to the read-only RDS instance from the primary RDS instance

View the data replication latency for a read-only RDS instance

A read-only RDS instance may synchronize data from the primary RDS instance at a specific latency. You can view the latency on the Basic Information page of the read-only RDS instance.

Read-only Instance Latency

Related operations

Operation Description
Create a read-only instance Creates a read-only ApsaraDB RDS instance.