Managing RO Groups

Last updated: 2021-09-02 18:14:23

    TencentDB for PostgreSQL allows you to create one or more read-only replicas to form a read-only replica group (RO group), which is suitable for read/write separation and one-primary-multiple-secondary application scenarios and capable of greatly enhancing the read load capacity of your databases.

    Prerequisites

    Creating an RO Group

    1. Log in to the TencentDB for PostgreSQL console. In the instance list, click the instance ID or Manage in the Operation column to access the instance management page.
    2. Click Add Read-only Replica in the Instance Architecture Diagram section on the Instance Details tab or click Create on the Read-only Replica tab.
    3. On the displayed purchase page, specify the following read-only replica configurations, confirm that everything is correct, and click Buy Now.
      • Specify RO Group: the Create RO Group option indicates that if multiple read-only replicas are purchased at a time, all of them will be assigned to the newly created RO group. The RO group automatically allocates read weights to each read-only replica, and automatically distributes read requests among the read-only replicas based on their read weights.
      • RO Group Name: the RO group name doesn't have to be unique and can contain up to 60 characters comprised of letters, digits, "-", "_", and ".".
      • Remove Read-only Replicas Exceeding the Delay Threshold: this option indicates whether to enable the removal policy. A read-only replica is removed from the RO group when its delay exceeds the threshold, and rejoins to the RO group when its delay is smaller than the threshold. A removed read-only replica will become inactive, its weight will be set to 0 automatically, and warning notifications will be sent out. For more information on how to configure the read-only replica removal alarm and recipients, please see Alarming.
        Whether or not this feature is enabled, read-only replicas will be removed upon failure, and rejoin to the RO group when it is recovered.
      • Delay Threshold: set a delay threshold for a read-only replica. When the data sync log size difference between the primary instance and the read-only replica is greater than the specified threshold, the read-only replica will be removed from the RO group.
      • Minimum Read-only Replicas: this is the minimum number of read-only replicas that have to be retained in the RO group. When there are fewer read-only replicas in the RO group, even if a read-only replica exceeds the delay threshold, it will not be removed.
    4. Return to the instance list. The status of the created read-only replica is Delivering. If the status changes to Running, the read-only replica has been successfully created.

    Configuring an RO Group

    On the RO group configuration page, you can configure the basic information of the group such as name, removal policy, delay threshold, minimum number of retained read-only replicas, and read weights.

    Note:

    Read-only replicas in an RO group can have different specifications, and read weights are automatically allocated to each replica according to its specification.

    1. Log in to the TencentDB for PostgreSQL console. In the instance list, click the primary instance ID or Manage in the Operation column to access the instance management page.
    2. On the Read-only Replica tab, click Configuration in the Operation column in the RO group list to access the RO group configuration page.
    3. Configure the RO group and click Submit.
      • Assign Read Weight: the traffic of each read-only replica in an RO group will be automatically distributed according to its read weight, which can realize load balancing and reduce the difficulty of managing multiple read-only replica IP addresses. An RO group automatically allocates read weights to each read-only replica. The following table lists the read weights of read-only replicas of different specifications:
        SpecificationWeight
        2 GB memory1
        4 GB memory2
        8 GB memory2
        12 GB memory4
        16 GB memory4
        24 GB memory8
        32 GB memory8
        48 GB memory10
        64 GB memory12
        96 GB memory14
        128 GB memory16
        240 GB memory26
        480 GB memory50
      • Rebalance Load:
        • If load rebalancing is disabled, modifying weight will take effect only for new loads, but neither affect the read-only replicas accessed by existing persistent connections nor cause short disconnection from the database.
        • If load rebalancing is enabled, when the configurations of read-only replicas in the RO group are modified, all connections to the RO group will be disconnected and new connections will be rebalanced according to the weights.

    Deleting an RO Group

    An RO group can be deleted if it has no read-only replicas.

    1. Log in to the TencentDB for PostgreSQL console. In the instance list, click the primary instance ID or Manage in the Operation column to access the instance management page.
    2. On the Read-only Replica tab, locate the desired RO group, confirm that it has no read-only replicas, and click More > Delete in the Operation column.