Overview
You can call this API to create a tenant in the specified OceanBase Cloud instance. You need to specify the tenant name, resource specification, character set, and time zone.
Note
To create a tenant of the specified resource specification, the cluster must have sufficient available resources.
API details
Constraints
The caller must have an AccessKey for accessing the multi-cloud API. For information about how to obtain the AccessKey ID and AccessKey secret, see Manage AccessKeys.
Request path
POST /api/v2/instances/{instanceId}/tenants
Request parameters
Path
Name |
Type |
Required |
Description |
Example value |
|---|---|---|---|---|
| instanceId | String | Yes | The ID of the OceanBase Cloud instance. | ob317v4uif**** |
Query
Name |
Type |
Required |
Description |
Example value |
|---|---|---|---|---|
| requestId | String | Yes | The ID of the request. This parameter is used for tracing. | dc302d76-66b5-48d8-ab53-a035******** |
Body
Name |
Type |
Required |
Description |
Example value |
|---|---|---|---|---|
| tenantName | String | Yes | The name of the tenant. The name is case-insensitive. | pay_**** |
| tenantId | String | No | The ID of the tenant. | t33h8y08k**** |
| tenantMode | String | Yes | The mode of the tenant. Valid values: Oracle and MySQL. If the database version is V4.2.1.8, V4.2.5, or V4.3.3, the tenant can only use the HBase API or the Table API. | Oracle |
| primaryZone | String | Yes | The primary zone of the tenant. The zone must be a zone in the cluster. | cn-hangzhou-h |
| charset | String | Yes | The character set.
Notice
|
utf8mb4 |
| collation | String | No | The collation. | utf8mb4_general_ci |
| description | String | No | The description of the database. | this is a test database |
| whitelist | String | No | The IP address whitelist of the tenant. | 192.168.1.0/24,10.0.0.1 |
| timeZone | String | Yes | The time zone of the tenant. For more information, see DescribeTimeZones. | Asia/Shanghai |
| cpu | Integer | Yes | The number of CPU cores of the tenant. | 2 |
| memory | Integer | Yes | The size of the memory of the tenant, in GiB. | 10 |
| diskSize | Integer | No | The size of the disk of the tenant, in GiB. | 100 |
| unitNum | Integer | No | The number of resource distribution nodes of the tenant. This parameter is related to the deployment mode of the cluster. For example, if the deployment mode of the cluster is 2-2-2, the maximum number of resource distribution nodes is 2. | 2 |
| environment | String | No | The environment of the tenant. | production |
| enablePublicLink | Boolean | No | Specifies whether to create a public endpoint.
|
false |
| parameterTemplate | String | No | The parameter template. | default_template |
| createParams | object | No | The parameters for creating the tenant. This parameter specifies whether to make the table names case-sensitive. The value is a HashMap. Example: createParams":{"lower_case_table_names":"1"} |
{"lower_case_table_names":"1"} |
| tenantCompatibilityModeEnum | String | No | The compatibility mode of the tenant. | MYSQL |
| proxyAddressMasterZone | String | No | The primary zone of the proxy. | cn-hangzhou-h |
| ProxySetting | Object | No | The proxy settings.
NoteThis parameter is supported only for instances created by using the AWS channel. |
|
| -mode | String | No | The type of the proxy cluster specification. | k8s_shared |
| -deploymentArchitecture | String | No | The deployment architecture of the proxy cluster.
|
DUAL_AZ_ACTIVE_ACTIVE_DEPLOYMENT |
| -zone | Array | No | The primary zones of the proxy nodes. | ["us-east-1a","us-east-1b"] |
| -slaveZone | Array | No | The standby zones of the proxy nodes. This parameter is required only if the deployment architecture is DUAL_AZ_ACTIVE_ACTIVE_DEPLOYMENT or DUAL_AZ_ACTIVE_STANDBY_DEPLOYMENT. | [] |
| -nodeCpu | Float | No | The specification of the proxy nodes. | 0.5 |
Response parameters
Name |
Type |
Description |
Example value |
|---|---|---|---|
| data | object | The information about the tenant. | |
| tenantId | String | The ID of the tenant. | t33h8y08k**** |
Examples
Request example
curl --request POST 'https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/tenants?requestId={requestId}' \
--digest -u '<Your ak:sk>' \
-H 'X-Ob-Project-Id: <Project ID>' \
-H 'Content-Type: application/json' \
--data '{"tenantName":"pay_test","tenantMode":"MySQL","primaryZone":"cn-hangzhou-h","charset":"utf8mb4","timeZone":"Asia/Shanghai","cpu":2,"memory":10,"unitNum":1,"description":"This is a test tenant.","proxySetting":{"mode":"k8s_shared","deploymentArchitecture":"DUAL_AZ_ACTIVE_ACTIVE_DEPLOYMENT","nodeCpu":0.5,"zone":["us-east-1a","us-east-1b"],"slaveZone":[]}}'
Note
- A project ID uniquely identifies a project. For information about how to obtain the project ID of an instance, see Manage projects.
- Make sure that the project ID corresponding to the specified instanceId is consistent with the specified project ID.
Response example
JSON format
{
"success": true,
"data": {
"tenantId": "t33h8y08k****"
},
"requestId": "dc302d76-66b5-48d8-ab53-a035********",
"server": "xxx.xxx.x.xxx:xxxx"
}
