Query tenants of a cluster

2023-08-15 02:30:55  Updated

Description

You can call this operation to query tenants of a cluster.

Call description

Prerequisite

You have the Read-only permission on the cluster.

Request path

GET /api/v2/ob/clusters/{clusterId}/tenants

Request parameters

Parameter Type Required Example value Description
clusterId Integer Yes 1 The ID of the cluster.
page Integer No 0 The number of the page to return. Pages start from page 1. Default value: 1.
size Integer No 10 The number of entries to return on each page. Maximum value: 2000.
sort String No asc,name The rule of sorting the tenants.
name String No foo The keyword in the cluster name. * The value is not case-sensitive. * The keyword must be included in the cluster name.
mode String No MYSQL The mode of the tenant. Valid values: MYSQL and ORACLE.
locked Boolean No true Specifies whether to lock the tenant.
readonly Boolean No Boolean Specifies whether to set the tenant to read-only.
status StringArray No CREATING The status of the tenant. * NORMAL * CREATING * MODIFYING * DELETING

Response parameters

  • Basic data structure

    Parameter Type Description
    data Object The requested service data.
    ├─ contents Array The array of the tenant information. For more information about its data structure, see the following table.
    ├─ page Object The page information.
    ├─ totalElements Integer The total number of entries.
    ├─ totalPage Integer The total number of pages.
    ├─ number Integer The page number of the returned page.
    ├─ size Integer The number of entries returned per page.
    successful Boolean Indicates whether the request was successful.
    timestamp Datetime The timestamp when the server completed the request.
    duration Integer The time taken by the server to process the request, in milliseconds.
    status Integer An HTTP status code.
    traceId String The trace ID of the request. This trace ID is used for troubleshooting.
    server String The address of the server that responded to the request.
  • Data structure of tenant information

    Parameter Type Description
    id Integer The ID of the tenant.
    name String The name of the tenant.
    clusterName String The name of the cluster to which the tenant belongs.
    clusterId Integer The ID of the cluster to which the tenant belongs. This ID is generated by the OCP system.
    obClusterId Integer The ID of the cluster to which the tenant belongs. This ID is generated by the OceanBase Database system.
    clusterType String The type of the cluster to which the tenant belongs. Valid values: * PRIMARY * STANDBY
    mode String The mode of the tenant. Valid values: * ORACLE * MYSQL
    createTime Datetime The time when the tenant was created.
    primaryZone String The zone priority of the tenant.
    zoneList String The zone list of the tenant.
    locality String The replica distribution of the tenant.
    status String The status of the tenant. Valid values: * NORMAL * CREATING * MODIFYING * DELETING
    locked Boolean Indicates whether the tenant was locked.
    readonly Boolean Indicates whether the tenant was read-only.
    obVersion String The OceanBase Database version of the cluster to which the tenant belongs.
    description String The description of the tenant.

Examples

Sample request

Query all tenants in the cluster whose ID is 8.

GET /api/v2/ob/clusters/8/tenants

Sample response

{
    "duration":197,
    "server":"192.168.100.1",
    "status":200,
    "successful":true,
    "timestamp":"2020-11-11T20:52:34.669+08:00",
    "traceId":"47e0c4c4a7a24207",
    "data":{
        "contents":[
            {
                "clusterId":1,
                "clusterName":"foo",
                "clusterType":"PRIMARY",
                "createTime":"2020-01-01T00:00:00+08:00",
                "id":10,
                "locality":"FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3",
                "locked":false,
                "mode":"Oracle",
                "name":"first",
                "obClusterId":1,
                "obVersion":"2.2.52",
                "primaryZone":"zone2,zone3;zone1",
                "readonly":false,
                "status":"NORMAL",
                "zoneList":"zone1;zone2;zone3"
            },
            {
                "clusterId":2,
                "clusterName":"bar",
                "clusterType":"PRIMARY",
                "createTime":"2020-01-02T00:00:00+08:00",
                "id":11,
                "locality":"FULL{1}@zone1",
                "locked":true,
                "mode":"MYSQL",
                "name":"second",
                "obClusterId":3,
                "obVersion":"2.2.72",
                "primaryZone":"zone1",
                "readonly":false,
                "status":"NORMAL",
                "zoneList":"zone1"
            }
        ],
        "page":{
            "number":1,
            "size":10,
            "totalElements":9,
            "totalPages":1
        }
    }
}

Contact Us