Updated on 2024-02-27 GMT+08:00

Creating a Proxy Instance

Function

This API is used to create a proxy instance in ELB mode. Before calling this API:

URI

POST /v3/{project_id}/instances/{instance_id}/proxy

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region.

To obtain this value, see Obtaining a Project ID.

instance_id

Yes

String

Instance ID, which is compliant with the UUID format.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

If the following response body is returned for calling the API used to obtain a user token, the request is successful.

After the request is processed, the value of X-Subject-Token in the message header is the token value.

X-Language

No

String

Request language type. The default value is en-us.

Value:

  • en-us
  • zh-cn
Table 3 Request body parameters

Parameter

Mandatory

Type

Description

flavor_ref

Yes

String

Proxy specification code.

node_num

Yes

Integer

Proxy instance nodes.

Value range: 2 to 32.

proxy_name

No

String

Proxy instance name. Instances of the same type can have same names under the same tenant.

The name consists of 4 to 64 characters and starts with a letter. It is case-sensitive and can contain only letters, digits, hyphens (-), and underscores (_).

proxy_mode

No

String

Proxy instance type. The default type is readwrite.

  • readwrite: read and write
  • readonly: read-only

route_mode

No

Integer

Routing policy of the proxy instance.

Value:

  • 0 (default value): weighted
  • 1: load balancing (The primary node does not process read requests.)
  • 2: load balancing (The primary node processes read requests.)

nodes_read_weight

No

Array of NodesWeight objects

Read weight of the node.

subnet_id

No

String

Subnet ID in the VPC of the database.

new_node_auto_add_status

No

String

Whether new nodes are automatically associate with proxy instances. To configure this parameter, contact customer service.

Value:

  • ON: New nodes are automatically associate with proxy instances.
  • OFF: New nodes are not automatically associate with proxy instances.

new_node_weight

No

Integer

Read weight of the new node.

  • If route_mode is 0 and new_node_auto_add_status is ON, the value of this parameter ranges from 0 to 1000.
  • If route_mode is not 0 and new_node_auto_add_status is OFF, this parameter is unavailable.
Table 4 NodesWeight

Parameter

Mandatory

Type

Description

id

No

String

Node ID.

weight

No

Integer

Weight assigned to the node.

  • If route_mode is 0, the value is 0 to 1000.
  • If route_mode is 1, the value for the primary node is 0 and the value for read replicas is 0 or 1.
  • If route_mode is 2, the value for the primary node is 1 and the value for read replicas is 0 or 1.

Response Parameters

Status code: 201

Table 5 Response body parameters

Parameter

Type

Description

job_id

String

Task ID.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Request

Creating a proxy instance (The proxy instance specifications are 2 vCPUs and 8 GB memory, and the proxy mode is read-only)

POST https://{endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances/43e4feaab48f11e89039fa163ebaa7e4br01/proxy
{
  "flavor_ref" : "gaussdb.proxy.large.x86.2",
  "node_num" : 2,
  "proxy_name" : "gaussdb-proxy",
  "proxy_mode" : "readonly",
  "route_mode" : 0,
  "nodes_read_weight" : [ {
    "id" : "45021bf73a244312a3f2af95092feeecno07",
    "weight" : 50
  }, {
    "id" : "d78a65690cea4af5ad14585e110ff89bno07",
    "weight" : 400
  } ],
  "subnet_id" : "6991d82d-9166-4aff-a1fa-d2a8748b7084"
}

Example Response

Status code: 201

Success.

{
  "job_id" : "04efe8e2-9255-44ae-a98b-d87cae411890"
}

Status Code

For details, see Status Codes.

Error Code

For details, see Error Codes.