Files
doc-exports/docs/rds/api-ref/rds_21_0004.html
wangdengke2 1ddaec1a62 rds_api
Reviewed-by: Gladkov, Maksim <mgladkov@noreply.gitea.eco.tsi-dev.otc-service.com>
Co-authored-by: wangdengke2 <wangdengke2@huawei.com>
Co-committed-by: wangdengke2 <wangdengke2@huawei.com>
2026-01-29 11:28:26 +00:00

20 KiB

Configuring the Routing Policy for a Database Proxy

Function

This API is used to configure the routing policy for a database proxy.

URI

  • Parameter description
    Table 1 Parameters

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Specifies the project ID of a tenant in a region.

    For details about how to obtain the project ID, see Obtaining a Project ID.

    instance_id

    Yes

    Specifies the DB instance ID.

    proxy_id

    Yes

    Database proxy ID.

Request

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

The content type.

The default value is application/json.

X-Auth-Token

Yes

String

Specifies the user token.

The user token is a response to the API used to obtain a user token.

Table 3 Parameters

Parameter

Mandatory

Type

Description

master_weight

Yes

Integer

Read weight of the primary instance.

  • When route_mode is set to 0, the value of this parameter ranges from 0 to 1000.
  • When route_mode is set to a value other than 0, this parameter does not take effect.

readonly_instances

Yes

Array of objects

Read weights of database nodes. For details, see Table 4.

  • You can only configure weights for read replicas.
  • This parameter can be left blank.

route_mode

Yes

Integer

Routing policy of the database proxy.

  • 0: weighted
  • 1: load balancing (The primary instance does not process read requests.)
  • 2: load balancing (The primary instance processes read requests.)
Table 4 readonly_instances field data structure description

Parameter

Mandatory

Type

Description

instance_id

Yes

String

Read Replica ID. For details, see Table 9.

weight

Yes

Integer

Read weight assigned.

Example Request

Configure the routing policy for a database proxy.

POST https://rds.eu-de.otc.t-systems.com/v3/23a50154cf494ec9ad6883979a12db0a/instances/ba0fd7c13cca4655820e0f858d5d467bin01/proxy/4e2a0c70f70f4807940db73a30b5b522po01/route-mode

{ 
   "master_weight" : 0, 
   "readonly_instances" : [ { 
     "instance_id" : "2edc88e921bb4129bb4d9b76be66811dno07", 
     "weight" : 1 
   } ], 
   "route_mode" : 2 
 }

Response

  • Normal response
    Table 5 Parameters

    Parameter

    Type

    Description

    result

    String

    Result of changing the routing policy of the database proxy.

    • failed
    • success

Status Code

Error Code

For details, see Error Codes.