1
0
forked from docs/doc-exports
doc-exports/docs/opengauss/api-ref/opengauss_newapi_0029.html
Ru, Li Yi d97aea4dd2 opengauss_api
Reviewed-by: Boka, Ladislav <ladislav.boka@t-systems.com>
Co-authored-by: Ru, Li Yi <liyiru7@huawei.com>
Co-committed-by: Ru, Li Yi <liyiru7@huawei.com>
2024-09-06 09:04:21 +00:00

14 KiB

Switching Roles of the Primary and Standby DNs in Shards

Function

This API is used to perform a primary/standby DN switchover for one or more shards. In a shard, only one standby node can be promoted to primary. Before calling this API:

URI

Request

  • Parameter description
    Table 2 Parameter description

    Name

    Mandatory

    Type

    Description

    shards

    Yes

    Array

    Nodes. You can switch standby DNs of multiple shards to primary DNs. The node information is the node IDs and component IDs of shards whose standby DNs are promoted to primary. For details, see Table 3.

    Table 3 shards parameter description

    Name

    Mandatory

    Type

    Description

    node_id

    Yes

    String

    ID of the node where the standby DN to be promoted to primary is deployed.

    component_id

    Yes

    String

    ID of the standby DN to be promoted to primary. It contains up to 7 characters. It cannot be null, an empty string or spaces. Before verifying and using it, spaces are automatically filtered out. The value contains at least three types of the following: uppercase letters, lowercase letters, digits, and underscores (_). For details about how to obtain the component ID, see Querying the Components of a DB Instance.

Example Request

Switching roles of primary and standby DNs in multiple shards
{
"shards":[ 
               { 
                      "node_id":"0bc478b4d132494a8f7b804da521b4b2no14", 
                      "component_id":"dn_6001" 
               }, 
               { 
                      "node_id":"53dee94c50574d36a0060db0a6b644f6no14", 
                      "component_id":"dn_6004" 
               } 
        ]
}

Response

  • Normal response
    Table 4 Parameter description

    Name

    Type

    Description

    job_id

    String

    ID of the task for switch standby DNs of multiple shards to primary DNs.

  • Example normal response
    {
    	"job_id": "e96bbb23-e053-4bd0-b0b7-16ad3f5d9b6d"
    }
  • Abnormal response

    For details, see Abnormal Request Results.

Status Code

Error Code

For details, see Error Codes.