Modifying unit configs means increasing or decreasing the CPU, memory, log disk capacity, etc. for unit configs.
Considerations
Before modifying a unit config, if the unit corresponding to the unit config is being used by a tenant and additional resources are needed, you must ensure that there is sufficient remaining resources available for allocation on each node during the resource increase process. You can query the total resources and allocated resources on each node through the oceanbase.GV$OB_SERVERS view, and then determine whether it is possible to modify the unit config.
If you need to increase a unit config, you must ensure that the total amount of resources after the increase meets the following requirements:
Sum(min_cpu) <= CPU_CAPACITY;
Sum(max_cpu) <= CPU_CAPACITY * resource_hard_limit;
Sum(memory_size) <= MEM_CAPACITY;
Sum(log_disk_size) <= LOG_DISK_CAPACITY;
where
CPU_CAPACITY: Indicates the total CPU capacity on a single node.resource_hard_limit: Indicates the amount of CPU resources allocated by the system when allocating units. The value range is [100, 10000]. The default value is100, indicating that over-allocation is not allowed.For more information about the
resource_hard_limitparameter, see resource_hard_limit.MEM_CAPACITY: Indicates the total memory capacity on a single node.LOG_DISK_CAPACITY: Indicates the total log disk capacity on a single node.The total log disk capacity is jointly controlled by the cluster-level parameters
log_disk_sizeandlog_disk_percentage.log_disk_sizeis used to set the size of the disk where redo logs are stored, with a default value of0.log_disk_percentageis used to set the percentage of the disk space occupied by redo logs, with a default value of0. The usage rules for these two parameters are as follows:If the value of
log_disk_sizeis0Mand that oflog_disk_percentageis not0, the system allocates the log disk space based on the value oflog_disk_percentage.If the value of
log_disk_sizeis not0M, the system allocates the log disk space based on the value oflog_disk_size, regardless of whether the value oflog_disk_percentageis0.If the value of
log_disk_sizeis0Mand that oflog_disk_percentageis0, the system automatically calculates the percentage of the disk space occupied by redo logs based on whether the log and data share the same disk.If they share the same disk, the percentage of the disk space occupied by redo logs is 30%.
If redo logs exclusively occupy the disk, the percentage of the disk space occupied by redo logs is 90%.
For more information about the
log_disk_sizeparameter, see log_disk_size.For more information about the
log_disk_percentageparameter, see log_disk_percentage.
If you need to decrease a unit config, you must ensure that the total amount of CPU, memory, log disk capacity after the decrease is greater than or equal to the currently used log disk space.
Limitations
Only the sys tenant can modify unit configs.
Procedure
When modifying unit configs, you can modify several items in CPU, memory, IOPS, and log disk capacity. The items that are not modified will remain unchanged.
Log in to the
systenant of the cluster using therootuser.Execute the following statement to modify a unit config:
ALTER RESOURCE UNIT unitname MAX_CPU [=] cpunum, [MIN_CPU [=] cpunum,] MEMORY_SIZE [=] memsize, [MAX_IOPS [=] iopsnum, MIN_IOPS [=] iopsnum,IOPS_WEIGHT [=]iopsweight,] [LOG_DISK_SIZE [=] logdisksize];An example of modifying the configurations of the
unit1resource unit is as follows:obclient> ALTER RESOURCE UNIT unit1 MAX_CPU 15, MEMORY_SIZE '20G', LOG_DISK_SIZE '4G';