Updated on 2024-07-30 GMT+08:00

How Are Read-only Services Split from Read-Write Services

This section describes how to isolate read-only services.

Precautions

  • The kernel version must be 2.4.1.2 or later.
  • If you want to use read-only groups to handle SQL queries, make sure that the associated data node is available and has available read replicas. If there are no available read replicas, the following error messages may be returned:
    • backend database connection error;
    • query has been canceled
    • execute error: No read-only node

Procedure

  1. Log in to the DDM console.
  2. On the Instances page, click the instance where you want to create a node group and click its name.
  3. In the Node Information area, click Create Group.
  4. On the displayed page, configure required parameters.

    Figure 1 Creating a node group
    Table 1 Parameter description

    Parameter

    Description

    Group Name

    The name must start with a letter and contains only letters, digits, and hyphens (-).

    Role

    There are two types of groups: read/write and read-only. Each group contains instance nodes with the same role and has a connection address.

    VPC

    The VPC is the same as the VPC where your instance is deployed, and cannot be changed.

    You can specify a subnet for the node group.

    Node Class

    One node belongs to only one group, and its group cannot be changed once determined. Nodes in the same group must be of the same class.

    AZ

    Select an AZ.

    Quantity

    One DDM instance supports multiple read-only groups. Each group contains at least 2 nodes, and each instance contains up to 32 nodes. You can click the plus icon to add nodes.

  5. Click Next.
  6. Confirm the configuration and click Submit.
  7. After the creation is complete, check whether the original Node Information area becomes the Group Information area. Then you can manage nodes in the group.

    Figure 2 Group information
    • After you create a node group, you can change node class, add or remove nodes, and configure access control.
    • After a node group is created for a DDM instance with no groups, existing nodes of the instance are included into another read/write group by default, responsible for handling read/write requests to core services.
    • Read traffic to read-only groups is forwarded to read replicas of data nodes by default. There may be noticeable latency because read replica data is asynchronously replicated from primary instances of the data nodes. If the latency exceeds the default or preset threshold, an access error is returned.
    • Deleting groups is not supported for yearly/monthly DDM instances.
    • To delete a group of a pay-per-use DDM instance, locate the group that you want to delete and click More > Delete Group in the Operation column. The corresponding floating IP address becomes invalid once the group is deleted. This may affect your services. Retain at least one read/write group.