All Products
Search
Document Center

ApsaraDB for MongoDB:DescribeDBInstanceSwitchLog

Last Updated:Sep 03, 2024

Queries the primary/secondary switching logs of an ApsaraDB for MongoDB instance.

Operation description

Before you call this operation, make sure that the ApsaraDB for MongoDB instance meets the following requirements:

  • The instance is a replica set or sharded cluster instance.
  • The instance uses local physical disks to store data.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
StartTimestringNo

The beginning of the time range to query. Specify the time in the ISO 8601 standard in the yyyy-mm-ddThh:mmZ format. The time must be in UTC.

2023-05-27T02:46Z
EndTimestringNo

The end of the time range to query. Specify the time in the ISO 8601 standard in the yyyy-mm-ddThh:mmZ format. The time must be in UTC. The end time must be later than the start time.

2023-05-28T02:00Z
PageNumberintegerNo

The number of the page to return. The value must be an integer that is greater than 0 and less than or equal to the maximum value supported by the integer data type. Default value: 1.

1
PageSizeintegerNo

The number of entries to return on each page. Valid values: 30, 50, and 100. Default value: 30.

30
DBInstanceIdstringNo

The instance ID.

dds-uf68f1b5a57exxxx

Response parameters

ParameterTypeDescriptionExample
object

Schema of Response

RequestIdstring

The request ID.

ECBCA991-XXXX-XXXX-834C-B3E8007F33AA
DBInstanceIdstring

The instance ID.

dds-uf68f1b5a57exxxx
TotalCountlong

The number of primary/secondary switching entries.

1
PageSizelong

The number of entries returned on each page.

30
PageNumberlong

The page number returned.

1
LogItemsarray<object>

The primary/secondary switchover logs.

object
SwitchStatusstring

The switchover status. Valid values: 1 and 0. The value 1 indicates a successful primary/secondary switchover and the value 0 indicates a failed primary/secondary switchover.

1
SwitchTimestring

The point in time when a primary/secondary switchover was performed. The time follows the ISO 8601 standard in the yyyy-mm-ddThh:mm:ssZ format. The time is displayed in UTC.

2023-02-07T18:00:00Z
SwitchCodestring

The code that indicates the reason of a primary/secondary switchover. Valid values:

  • USER_CONSOLE_OPERATION: The switchover is manually performed.
  • OPERATION_AND_MAINTENANCE: Potential risks exist.
  • MACHINE_DOWNTIME: The host is offline.
  • PRIMARY_UNHEALTHY: An exception occurs on the primary node of the instance.
  • SECONDARY_UNHEALTHY: An exception occurs on the secondary node of the instance.
  • MULTIPLE_NODE_FAILURES: An exception occurs on multiple nodes of the instance.
USER_CONSOLE_OPERATION
NodeIdstring

The ID of the replica set instance or the ID of the node on which a primary/secondary switchover is performed.

dds-uf68f1b5a57exxxx

Examples

Sample success responses

JSONformat

{
  "RequestId": "ECBCA991-XXXX-XXXX-834C-B3E8007F33AA",
  "DBInstanceId": "dds-uf68f1b5a57exxxx",
  "TotalCount": 1,
  "PageSize": 30,
  "PageNumber": 1,
  "LogItems": [
    {
      "SwitchStatus": "1",
      "SwitchTime": "2023-02-07T18:00:00Z",
      "SwitchCode": "USER_CONSOLE_OPERATION",
      "NodeId": "dds-uf68f1b5a57exxxx"
    }
  ]
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidParameterCombinationThe end time must be greater than the start timeThe start time must be earlier than the end time.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history