Description
You can execute the CREATE RESOURCE UNIT statement to create a resource unit. In this statement, you can specify parameters to assign hardware resources to tenants.
Syntax
CREATE RESOURCE UNIT unitname
MAX_CPU [=] cpunum,
MAX_MEMORY [=] memsize,
MAX_IOPS [=] iopsnum,
MAX_DISK_SIZE [=] disksize,
MAX_SESSION_NUM [=] sessionnum,
[MIN_CPU [=] cpunum,]
[MIN_MEMORY [=] memsize,]
[MIN_IOPS [=] iopsnum] ;
Parameters
| Parameter | Description |
|---|---|
| MAX_CPU | The maximum number of CPUs. |
| MAX_MEMORY | The maximum memory size. Valid values: [1073741824,+∞). The unit is bytes. The minimum value 1073741824 bytes is equivalent to 1 GB. |
| MAX_IOPS | The maximum IOPS. Valid values: [128,+∞). |
| MAX_DISK_SIZE | The maximum disk capacity. Valid values: [536870912,+∞). The unit is bytes. The minimum value 536870912 bytes is equivalent to 512 MB. |
| MAX_SESSION_NUM | The maximum number of sessions. Valid values: [64,+∞). |
| MIN_CPU | The minimum number of CPUs. |
| MIN_MEMORY | The minimum memory size. |
| MIN_IOPS | The minimum IOPS. |
Examples
- Create resource unit unit1. The resource unit has one CPU, 1 GB memory, 128 IOPS, 10 GB disk capacity, and 64 sessions.
OceanBase(admin@test)> CREATE RESOURCE UNIT unit1 max_cpu 1, max_memory '1G', max_iops 128,max_disk_size '10G', max_session_num 64, MIN_CPU=1, MIN_MEMORY= '1G', MIN_IOPS=128;
Query OK, 0 rows affected (0.02 sec)
- Create resource unit unit1. The resource unit has one CPU, 1 GB memory, 128 IOPS, 10 GB disk capacity, and 64 sessions.
OceanBase(admin@test)> CREATE RESOURCE UNIT unit1 max_cpu 1, max_memory 1073741824, max_iops 128, max_disk_size 10737418240, max_session_num 64, MIN_CPU=1, MIN_MEMORY=1073741824, MIN_IOPS=128;
Query OK, 0 rows affected (0.01 sec)