Purpose
OceanBase AI Database manages physical resources through resource units. The sys tenant can use the CREATE RESOURCE UNIT statement to create a resource unit and specify its resource specifications. A resource unit's specifications define common physical resources, including CPU, memory, log disk storage space, and IOPS.
The resource specification of a unit defines the total amount of resources that can be allocated to a single OBServer node within a single zone. A tenant can use the resources on a node to store data only if the tenant has a unit on that node.
The total amount of resources allocated to a tenant is calculated as follows: Unit specification × Number of units.
Limitations and considerations
The unit's resource specification cannot exceed the total allocatable resources of a single node.
Privilege requirements
Only the root user of the sys tenant (root@sys) can create units. Other tenants do not support creating units.
Syntax
CREATE RESOURCE UNIT [IF NOT EXISTS] unit_name
MEMORY_SIZE [=] 'size_value',
MAX_CPU [=] cpu_num,
[MAX_IOPS [=] iops_num,]
[MIN_CPU [=] cpu_num,]
[MIN_IOPS [=] iops_num,]
[IOPS_WEIGHT [=]iopsweight,]
[MAX_NET_BANDWIDTH [=] bandwidth_num,]
[NET_BANDWIDTH_WEIGHT [=] bandwidth_weight_num,]
[DATA_DISK_SIZE [=] 'size_value',]
[LOG_DISK_SIZE [=] 'size_value'];
Parameters
Parameter |
Description |
|---|---|
| IF NOT EXISTS | Optional. If the unit to be created already exists and no specific value is specified for this parameter, IF NOT EXISTS, an error will be returned. |
| unit_name | Specifies the name of the unit. |
| MEMORY_SIZE | Specifies the memory specification. Its minimum value is determined by the hidden parameter __min_full_resource_pool_memory, whose default value is 5 GB. To ensure system stability, we recommend that you set the minimum memory to 4 GB.
NoticeOceanBase AI Database no longer supports memory overprovisioning. |
| MAX_CPU | Specifies the upper limit of CPU specifications. The minimum value is 1, which indicates 1 core. |
| MIN_CPU | Specifies the minimum CPU specification. The minimum value is 1, which indicates 1 core. This parameter is required. If this parameter is not specified, its default value is equal to MAX_CPU.
NoticeThe sum of |
| MAX_IOPS | Specify the upper limit of IOPS. The minimum value is 1024. The specified value must meet the following requirements: MAX_IOPS >= MIN_IOPS, which is optional. If not specified, the system automatically calculates the value of MAX_IOPS based on the following rules:
|
| MIN_IOPS | Specifies the lower limit of IOPS. The minimum value is 1024, which is optional. If not specified, the system automatically calculates the value of MIN_IOPS based on the following rules:
|
| IOPS_WEIGHT | Optional. Specifies the weight value for IOPS. If not specified, the system automatically calculates the value of IOPS_WEIGHT based on the following rules:
|
| MAX_NET_BANDWIDTH | Specifies the maximum network bandwidth allowed for each unit of the tenant. The minimum value is 1 MB. If not specified, the default value is INT64_MAX. |
| NET_BANDWIDTH_WEIGHT | Specifies the network bandwidth weight of a tenant unit, which is used to calculate the proportion of bandwidth allocated to each tenant by each OBServer node. The minimum value is 0. If not specified, the system automatically calculates the value of NET_BANDWIDTH_WEIGHT according to the following rules:
|
| DATA_DISK_SIZE | Specifies the size of local disk space available for each unit of the tenant. When this parameter is specified:
NoteCreate a tenant, migration, or scale-out, the system considers the |
| LOG_DISK_SIZE | Specifies the size of the log disk space for the tenant. Optional. If not specified, the default value is three times the memory specification, with a minimum value of 2 GB. |
Examples
Create a unit named
unit1, specifying the following parameters: 4 CPU cores,5Gof memory,10Gof log disk capacity, an IOPS upper limit of1280, an IOPS lower limit of1024, and an IOPS weight of1. The unit also has a maximum network bandwidth of5Mand a network bandwidth weight of10.obclient(root@sys)[(none)]> CREATE RESOURCE UNIT unit1 MAX_CPU 4, MEMORY_SIZE '5G', MAX_IOPS 1280, MIN_IOPS=1024, IOPS_WEIGHT=1, MAX_NET_BANDWIDTH '5M',NET_BANDWIDTH_WEIGHT 10, LOG_DISK_SIZE '10G';After the unit is successfully created, you can confirm the creation result through a view. The statement is as follows:
obclient(root@sys)[oceanbase]> SELECT * FROM oceanbase.DBA_OB_UNIT_CONFIGS WHERE NAME='unit1';The query result is as follows:
+----------------+-------+----------------------------+----------------------------+---------+---------+-------------+---------------+----------------+----------+----------+-------------+-------------------+----------------------+ | UNIT_CONFIG_ID | NAME | CREATE_TIME | MODIFY_TIME | MAX_CPU | MIN_CPU | MEMORY_SIZE | LOG_DISK_SIZE | DATA_DISK_SIZE | MAX_IOPS | MIN_IOPS | IOPS_WEIGHT | MAX_NET_BANDWIDTH | NET_BANDWIDTH_WEIGHT | +----------------+-------+----------------------------+----------------------------+---------+---------+-------------+---------------+----------------+----------+----------+-------------+-------------------+----------------------+ | 1001 | unit1 | 2025-05-28 11:19:39.116490 | 2025-05-28 11:19:39.116490 | 4 | 4 | 5368709120 | 10737418240 | NULL | 1280 | 1024 | 1 | 5242880 | 10 | +----------------+-------+----------------------------+----------------------------+---------+---------+-------------+---------------+----------------+----------+----------+-------------+-------------------+----------------------+ 1 row in setCreate a unit named
unit1, specifying 4 CPU cores,5Gof memory, and100Gof local disk space per unit.obclient(root@sys)[(none)]> CREATE RESOURCE UNIT unit1 MAX_CPU 4, MEMORY_SIZE '5G', DATA_DISK_SIZE '100G';
References
Create a tenant