tencent cloud

文档反馈

DescribeDBInstanceHAConfig

最后更新时间:2024-07-30 17:24:48

    1. API Description

    Domain name for API request: postgres.tencentcloudapi.com.

    This API is used to query the HA configuration of an instance, which includes:

  • Allow a standby node to promote to a primary node.
  • Allow a semi-sync instance to adopt sync or async replication.

    A maximum of 20 requests can be initiated per second for this API.

    We recommend you to use API Explorer
    Try it
    API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

    2. Input Parameters

    The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

    Parameter Name Required Type Description
    Action Yes String Common Params. The value used for this API: DescribeDBInstanceHAConfig.
    Version Yes String Common Params. The value used for this API: 2017-03-12.
    Region No String Common Params. This parameter is not required for this API.
    DBInstanceId Yes String Instance ID

    3. Output Parameters

    Parameter Name Type Description
    SyncMode String Primary-standby sync mode. Valid values:
  • Semi-sync
  • Async
  • MaxStandbyLatency Integer Maximum data lag for high-availability standby server. The standby node can be promoted to the primary node when its data lag and the delay time are both less than the value of MaxStandbyLatency and MaxStandbyLag respectively.
  • Unit: byte
  • Value range: 1073741824-322122547200
  • MaxStandbyLag Integer The maximum delay for high-availability standby server The standby node can be promoted to the primary node when its data lag and the delay time are both less than or equals to the value of MaxStandbyLatency and MaxStandbyLag respectively.
  • Unit: s
  • Value range: 5-10
  • MaxSyncStandbyLatency Integer Maximum data sync lag for standby server. If data lag of the standby node and the delay time are both less than or equals to the values of MaxSyncStandbyLatency and MaxSyncStandbyLag respectively, the standby server adopts semi-sync replication; if not, it adopts async replication.
    This value is only valid for the instance with SyncMode set to Semi-sync.
    This field returns null for async instance
    and semi-sync (non-downgradable to async) instance.
    Note: This field may return null, indicating that no valid values can be obtained.
    MaxSyncStandbyLag Integer Maximum sync delay time for standby server. If the delay time for standby server and the data lag are both less than or equals to the values of MaxSyncStandbyLag and MaxSyncStandbyLatency respectively, the standby server adopts sync replication mode; if not, it adopts async replication.
    This value is only valid for the instance with SyncMode set to Semi-sync.
    This field will not return for async instance
    and semi-sync (non-downgradable to async) instance.
    Note: This field may return null, indicating that no valid values can be obtained.
    RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

    4. Example

    Example1 Querying the HA configuration of the instance that adopts the async replication

    This example shows you how to query the HA configuration by ID of the instance that adopts async replication.

    Input Example

    POST / HTTP/1.1
    Host: postgres.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DescribeDBInstanceHAConfig
    <Common request parameters>
    
    {
        "DBInstanceId": "postgres-32d4mmv9"
    }
    

    Output Example

    {
        "Response": {
            "MaxStandbyLag": 10,
            "MaxStandbyLatency": 10737418240,
            "MaxSyncStandbyLag": null,
            "MaxSyncStandbyLatency": null,
            "RequestId": "730627a4-547d-422b-8aac-239041b12212",
            "SyncMode": "Async"
        }
    }
    

    Example2 Querying the HA configuration of the instance that adopts the semi-sync (downgradable to async) replication

    This example shows you how to query the HA configuration by ID of the instance that adopts semi-sync (downgradable to async) replication.

    Input Example

    POST / HTTP/1.1
    Host: postgres.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DescribeDBInstanceHAConfig
    <Common request parameters>
    
    {
        "DBInstanceId": "postgres-32d4mmv9"
    }
    

    Output Example

    {
        "Response": {
            "MaxStandbyLag": 10,
            "MaxStandbyLatency": 10737418240,
            "MaxSyncStandbyLag": 5,
            "MaxSyncStandbyLatency": 1073741824,
            "RequestId": "897783db-0451-479b-a205-b2b0e48d29a8",
            "SyncMode": "Semi-sync"
        }
    }
    

    Example3 Querying the HA configuration of the instance that adopts the semi-sync (non-downgradable to async) replication

    This example shows you how to query the HA configuration by ID of the instance that adopts semi-sync (non-downgradable to async) replication.

    Input Example

    POST / HTTP/1.1
    Host: postgres.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DescribeDBInstanceHAConfig
    <Common request parameters>
    
    {
        "DBInstanceId": "postgres-32d4mmv9"
    }
    

    Output Example

    {
        "Response": {
            "MaxStandbyLag": 10,
            "MaxStandbyLatency": 10737418240,
            "MaxSyncStandbyLag": null,
            "MaxSyncStandbyLatency": null,
            "RequestId": "a5399d5a-c77b-4c57-9a17-790e9c61ab33",
            "SyncMode": "Semi-sync"
        }
    }
    

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

    Error Code Description
    FailedOperation.DatabaseAccessError Failed to access database management service. Please try again later. If the problem persists, please contact customer service.
    FailedOperation.DatabaseAffectedError Data operation failed. Please contact customer service.
    FailedOperation.FailedOperationError Operation failed. Please try again later.
    InvalidParameter.ParameterCheckError Failed to check the parameter.
    InvalidParameterValue.InvalidParameterValueError Incorrect parameter value
    OperationDenied.CamDeniedError This operation cannot be performed.
    OperationDenied.InstanceStatusLimitError This operation cannot be performed on an instance in this status.
    ResourceNotFound.InstanceNotFoundError The instance does not exist.