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 contains 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. If the primary RDS instance uses standard SSDs or enhanced SSDs (ESSDs), no specific instance specifications are required.
  • 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 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 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 that are run 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.
  • 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 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.

Procedure

  1. Visit the RDS instance list, select a region above, and click the target instance ID.
  2. In the Distributed by Instance Role section of the Basic Information page, click Add next to 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. For long-term use, 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. For short-term use, 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 switch the read-only RDS instance to the subscription billing method.
    Zone The zone to which the read-only RDS instance belongs. Each zone is an independent physical location in a region. No major differences exist between zones that are located in the same region. 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 RDS instance exclusively occupies the allocated memory and I/O resources, but shares CPU and storage resources with the other general-purpose RDS instances that are deployed on the same server.
    • 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 RDS instance occupies all CPU, memory, storage, and I/O resources on the physical host where the RDS 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, binary log 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 specify the VPC and VSwitch of Primary Node parameters. If you set the Deployment Method parameter in the previous step to Multi-zone deployment, you must also specify 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 the RDS instance and the ECS instance both 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 that are run 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. 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. Visit the RDS instance list, select a region above, and click the target instance ID.
    2. On the Basic Information page, 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.

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

Related operations

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