Updated on 2024-05-20 GMT+08:00

Obtaining the killOp Rule List

API Description

This API is used to obtain the killOp rule list.

Restrictions

  • This API applies only to replica set and cluster instances.
  • This API is available only for DDS 3.4 or later.
  • This API is available only for an instance node with 4 or more vCPUs.

URI

  • URI format

    GET https://{Endpoint}/v3/{project_id}/instances/{instance_id}/kill-op-rule

  • URI example

    https://dds.ap-southeast-1.myhuaweicloud.com/v3/2900b7b8d03e4619b8db8d43bc6234ee/instances/70ddf44609734098a8d333f25a368976in02/kill-op-rule?namespaces=test.ym&plan_summary=COLLSCAN

    Table 1 Request parameters

    Parameter

    Mandatory

    Type

    Description

    X-Auth-Token

    Yes

    String

    User token obtained from IAM. For details, see Authentication.

    project_id

    Yes

    String

    Project ID of a tenant in a region. Obtain the project ID by following the instructions in Obtaining a Project ID.

    instance_id

    Yes

    String

    Instance ID, which can be obtained by calling the API described in Querying Instances and Details. If you do not have an instance, call the API described in Creating a DB Instance to create one.

    Table 2 Query parameters

    Parameter

    Mandatory

    Type

    Description

    operation_types

    No

    String

    SQL type.
    • insert: operation for inserting data.
    • update: operation for updating data.
    • query: operation for querying data.
    • command: command operation.
    • remove: operation for deleting data.
    • getmore: operation for obtaining more data.

    namespaces

    No

    String

    Namespace of a table. The value is in the format of database_name or database_name.table_name.
    • This parameter can be left empty, indicating that this rule has no restrictions on table namespaces.
    • If this parameter is set to a database name, this rule applies to operations on all collections in the database.
    • If this parameter is set to a value in the format of database_name.collection_name, this rule only applies to operations on the collection.

    status

    No

    String

    The killOp rule status.
    • ENABLED: The rule is enabled.
    • DISABLED: The rule is disabled.

    plan_summary

    No

    String

    Execution plan. By default, this parameter is left blank, indicating that this rule has no restrictions on execution plans.
    • COLLSCAN
    • SORT_KEY_GENERATOR
    • SKIP
    • LIMIT
    • GEO_NEAR_2DSPHERE
    • GEO_NEAR_2D
    • AGGREGATE
    • OR

    offset

    No

    Integer

    Index offset.

    If offset is set to N, the resource query starts from the N+1 piece of data. The default value is 0, indicating that the query starts from the first piece of data. The value must be a positive number or 0.

    limit

    No

    Integer

    Maximum records to be queried.
    • The value ranges from 1 to 100.
    • If this parameter is not transferred, the first 100 records are queried by default.

Requests

  • Parameter description

    None

  • Example request

    None

Responses

  • Parameter description
    Table 3 Response body parameters

    Parameter

    Type

    Description

    rules

    Array of Table 4

    List.

    total_count

    Integer

    Total number.

    Table 4 KillOpRule parameters

    Parameter

    Type

    Description

    id

    String

    ID of the killOp rule.

    operation_types

    String

    SQL type. A maximum of six statement types can be selected at a time. If multiple types are selected, the rule takes effect when any type is matched.
    • insert: operation for inserting data.
    • update: operation for updating data.
    • query: operation for querying data.
    • command: command operation.
    • remove: operation for deleting data.
    • getmore: operation for obtaining more data.

    status

    String

    The killOp rule status.
    • ENABLED: The rule is enabled.
    • DISABLED: The rule is disabled.

    namespaces

    String

    Namespace of a table. The value is in the format of database_name or database_name.table_name. If multiple namespaces are configured at the same time, the rule takes effect when any namespace is matched.
    • Currently, only one namespace can be configured.
    • This parameter can be left empty, indicating that this rule has no restrictions on table namespaces.
    • If this parameter is set to a database name, this rule applies to operations on all collections in the database.
    • If this parameter is set to a value in the format of database_name.collection_name, this rule only applies to operations on the collection.

    client_ips

    String

    Client IP address.
    • Only IPv4 is supported.
    • This parameter can be left empty, indicating that this rule has no restrictions on client IP addresses.
    • A maximum of five IP addresses can be configured at a time. If multiple IP addresses are configured, the rule takes effect when any IP address is matched.

    plan_summary

    String

    Execution plan. By default, this parameter is left blank, indicating that this rule has no restrictions on execution plans.
    • COLLSCAN
    • SORT_KEY_GENERATOR
    • SKIP
    • LIMIT
    • GEO_NEAR_2DSPHERE
    • GEO_NEAR_2D
    • AGGREGATE
    • OR

    max_concurrency

    Integer

    Maximum number of concurrent SQL statements.

    The value cannot be a negative number. This parameter can be left empty. The default value is 0, indicating that this rule has no restrictions on the maximum number of concurrent SQL statements. The value ranges from 1 to 100000.

    secs_running

    Integer

    Maximum execution duration of a single SQL statement.

    The value cannot be a negative number. This parameter can be left empty. The default value is 0, indicating that this rule has no restrictions on the maximum execution duration of a single SQL statement. The unit is second. The value ranges from 2 to 86400.

    node_type

    String

    Node type.
    • mongos_shard indicates that this rule applies to both mongos and shard nodes.
    • mongos indicates that this rule only applies to the mongos node in a cluster.
    • shard indicates that this rule only applies to the shard node in a cluster.
    • replica indicates that this rule applies to replica sets.
  • Example response
    killOp rule list:
    { 
      "rules" : [ { 
        "operation_types" : [ "query", "insert" ], 
        "namespaces" : [ "db.collections" ], 
        "client_ips" : [ "172.168.201.144" ], 
        "status" : "ENABLED", 
        "id" : "f6f2cea4-ce40-4d4c-9d2f-61253d215811", 
        "plan_summary" : "COLLSCAN", 
        "max_concurrency" : 0, 
        "secs_running" : 5, 
        "node_type" : "replica" 
      } ], 
      "total_count" : 1 
    }

Status Code

For more information, see Status Code.

Error Code

For more information, see Error Code.