tencent cloud

文档反馈

ModifyDBInstanceHAConfig

最后更新时间:2024-07-30 17:29:43

    1. API Description

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

    This API is used to modify the HA configuration of an instance. which includes:

  • Allow the standby node to promote to the 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: ModifyDBInstanceHAConfig.
    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
    SyncMode Yes String Primary-standby sync mode. Valid values:
  • Semi-sync
  • Async
  • MaxStandbyLatency Yes 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 Yes 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 or equals to the value of MaxStandbyLatency and MaxStandbyLag respectively.
  • Unit: s
  • Value range: 5-10
  • MaxSyncStandbyLatency No Integer Maximum data sync lag for standby server. If data lag of the standby node and the delay ime are both less than or equals to the values of MaxSyncStandbyLatency and MaxSyncStandbyLag, 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.
    When the semi-sync replication mode of the instance is not allowed to downgrade to async replication, MaxSyncStandbyLatency and MaxSyncStandbyLag are not required.
    When the semi-sync instance is allowed to downgrade to async replication, MaxSyncStandbyLatency is required and MaxSyncStandbyLag must be left empty for PostgreSQL 9; MaxSyncStandbyLatency and MaxSyncStandbyLag` are required for PostgreSQL 10 and later.
    MaxSyncStandbyLag No Integer Maximum delay for sync standby server. If the delay time for standby server and the data lag are both less than or equals to the value 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.
    When the semi-sync replication mode of the instance is not allowed to downgrade to async replication, MaxSyncStandbyLatency and MaxSyncStandbyLag are not required.
    When the semi-sync instance is allowed to downgrade to async replication, MaxSyncStandbyLatency is required and MaxSyncStandbyLag must be left empty for PostgreSQL 9; MaxSyncStandbyLatency and MaxSyncStandbyLag` are required for PostgreSQL 10 and later.

    3. Output Parameters

    Parameter Name Type Description
    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 Modifying the replication mode to be async

    This example shows you how to set the primary-standby replication mode to be async and the maximum delay for switch.

    Input Example

    POST / HTTP/1.1
    Host: postgres.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: ModifyDBInstanceHAConfig
    <Common request parameters>
    
    {
        "DBInstanceId": "postgres-32d4mmv9",
        "SyncMode": "Async",
        "MaxStandbyLatency": 10737418240,
        "MaxStandbyLag": 10
    }
    

    Output Example

    {
        "Response": {
            "RequestId": "c4676122-1694-4d0f-8b03-a33b4e1bd850"
        }
    }
    

    Example2 Modifying the replication mode to be semi-sync (downgradable to async)

    This example shows you how to set the primary-standby replication mode to be semi-sync (downgradable to async) and the maximum delay for switch.

    Input Example

    POST / HTTP/1.1
    Host: postgres.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: ModifyDBInstanceHAConfig
    <Common request parameters>
    
    {
        "DBInstanceId": "postgres-32d4mmv9",
        "SyncMode": "Semi-sync",
        "MaxStandbyLatency": 10737418240,
        "MaxStandbyLag": 10,
        "MaxSyncStandbyLatency": 1073741824,
        "MaxSyncStandbyLag": 5
    }
    

    Output Example

    {
        "Response": {
            "RequestId": "34c1d54c-ea3e-4594-8a5d-1b739123949d"
        }
    }
    

    Example3 Modifying the replication mode to be semi-sync (non-downgradable to async)

    This example shows you how to set the primary-standby replication mode to be semi-sync (non-downgradable to async) and the maximum delay for switch.

    Input Example

    POST / HTTP/1.1
    Host: postgres.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: ModifyDBInstanceHAConfig
    <Common request parameters>
    
    {
        "DBInstanceId": "postgres-32d4mmv9",
        "SyncMode": "Semi-sync",
        "MaxStandbyLatency": 10737418240,
        "MaxStandbyLag": 10
    }
    

    Output Example

    {
        "Response": {
            "RequestId": "9b923bd9-6a3b-482a-945d-ea2e6f2a9f17"
        }
    }
    

    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.FailedOperationError Operation failed. Please try again later.
    InvalidParameter.ParameterCheckError Failed to check the parameter.
    InvalidParameter.ParametersNotSet You can't left all parameters empty.You need to set at least one of the parameters.
    InvalidParameterValue.InvalidParameterValueError Incorrect parameter value
    InvalidParameterValue.ParameterOutOfRange Invalid parameter
    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.
  • 联系我们

    联系我们,为您的业务提供专属服务。

    技术支持

    如果你想寻求进一步的帮助,通过工单与我们进行联络。我们提供7x24的工单服务。

    7x24 电话支持