This topic describes the endpoints of PolarDB-X instances and how to configure an endpoint.

Background information

If you do not create a read-only instance for a primary instance, you can use only one endpoint to connect to the primary instance. This endpoint is known as a cluster endpoint. A cluster endpoint is used in general scenarios for online business. If read-only instances are created, the read-only instances appear on the Instance List page. On the instance details page of a read-only instance, one read-only routing endpoint is provided to connect to the read-only instance. A read-only routing endpoint ensures that you have exclusive resources in scenarios in which access to resources is isolated, such as batch processing and the export of offline data. If you purchase a primary instance and a read-only instance in scenarios in which hybrid transaction/analytical processing (HTAP) is performed, you can use the cluster and read-only routing endpoints.

Configure a cluster endpoint

  1. Log on to the PolarDB-X console.
  2. In the top navigation bar, select the region where your instance is deployed.
  3. On the Instance List page, click the PolarDB-X 2.0 tab.
  4. Click the name of the primary instance. On the page that appears, click Basic information in the left-side navigation pane.
  5. In the Connection information section, click the 456789 icon next to Cluster address.
  6. Click Configuration Management to view the configuration items of the cluster endpoint.

    Parameter description

    Parameter Description
    Resource Configuration If you have purchased a read-only instance, you can add the read-only instances that are used to offload requests to the resource pool of the primary instance. Those that are not added will not share the traffic of the primary instance.
    Read-only instances are automatically added. Controls whether newly purchased read-only instances are added to the resource pool of the primary instance. By default, this feature is enabled.
    Intelligent read-write separation By default, this feature is enabled. PolarDB-X can automatically route the traffic generated by analytical processing (AP) to the read-only instances and perform massively parallel processing (MPP). This helps accelerate query execution.
    Percentage of read-only traffic The read queries that need to be routed to the storage nodes of the primary instance are routed to the storage nodes of read-only instances based on the specified percentage. This way, the query data can be stored in the read-only instances.
    Read data consistency
    • Strong consistency: If requests are routed to the read-only instances, the data that is updated on the primary instance before the read requests are performed can be queried. This provides external strong consistency.
    • Weak consistency: If requests are routed to the read-only instances, only the latest data can be read from the read-only instances. Data reads are delayed due to asynchronous replication between your primary and read-only instances.
    Note Due to the read latency, data that requires strong consistency can be read only after the data is updated. By default, 3 seconds are consumed to read the data.
    Read-only latency threshold If this threshold is exceeded, read-only requests are sent to other read-only instances in which the read latency does not exceed the threshold. You can also determine whether to send the requests back to the primary instance based on the availability of the read-only instances.
    Read-only availability If the read latency in each read-only instance exceeds the threshold or each read-only instance is in the high availability (HA) status, all read-only instances are considered to be unavailable and the system determines whether to switch read-only requests back to the primary instance. We recommend that two or more read-only instances be used to improve the availability of read-only instances.
Note
  • A maximum of three seconds are required to read data that requires strong consistency. You can change the value of the loose_replica_read_timeout parameter on the Parameter Settings interface to specify the timeout period that is required to read the data.
  • The PolarDB-X version must be 5.4.13-16415631 or later for the read/write splitting feature.

Configure a read-only routing endpoint

  1. Log on to the PolarDB-X console.
  2. In the top navigation bar, select the region where your instance is deployed.
  3. On the Instance List page, click the PolarDB-X 2.0 tab.
  4. Click the name of the read-only instance in the console. On the page that appears, click Basic information in the left-side navigation pane.
  5. Click the 456789 of the read-only routing endpoint.
  6. Click Configuration Management to view the configuration items of the read-only routing endpoint.
    Parameter description
    • Strong consistency: You can use the read-only routing endpoint to query the latest data that is submitted by the primary instance. This ensures the consistency of global data queries. If replication latency between your primary and read-only instances is large, the queried data cannot be immediately returned.
    • Weak consistency: You can use the read-only routing endpoint to query the latest data of the read-only instance. The queried data can be immediately returned even if replication latency between your primary and read-only instances exists.