Modifying a resource specification means increasing or decreasing the CPU, memory, log disk capacity, and other settings in the resource specification.
Considerations
Before modifying a resource specification, if the unit corresponding to the resource specification is being used by a tenant and you confirm that resources need to be increased, you must ensure that each node has sufficient remaining resources for allocation during the increase process. You can query the oceanbase.GV$OB_SERVERS view for the total resources and allocated resources on each node, and then determine whether the resource specification can be modified through calculation.
To increase the resource specification, the total resources after modification must meet 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: the total CPU capacity on a single node.MEM_CAPACITY: the total memory capacity on a single node.LOG_DISK_CAPACITY: 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. Thelog_disk_sizeparameter is used to set the size of the Redo log disk, and its default value is0. Thelog_disk_percentageparameter is used to set the percentage of the total disk space occupied by Redo logs, and its default value is0. The usage rules for the two parameters are as follows:If the value of
log_disk_sizeis0Mand the value oflog_disk_percentageis not0, the system allocates log disk space based on the value oflog_disk_percentage.If the value of
log_disk_sizeis not0M, the system allocates log disk space based on the value oflog_disk_sizeregardless of whether the value oflog_disk_percentageis0.If the value of
log_disk_sizeis0Mand the value oflog_disk_percentageis0, the system automatically calculates the percentage of the total disk space occupied by Redo logs based on whether logs and data share the same disk:When shared, the percentage of the total disk space occupied by Redo logs is 30%.
When exclusive, the percentage of the total 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.resource_hard_limit: the value of a parameter.When allocating units, the system allocates CPU resources based on the value of the
resource_hard_limitparameter. The default value is100, indicating that overprovisioning is not allowed. The value range is[100, 10000].For more information about the
resource_hard_limitparameter, see resource_hard_limit.
To decrease the resource specification, ensure that the total CPU, memory, log disk capacity, and other resources after modification are greater than or equal to the currently used log disk space.
Limitations
Only the sys tenant can modify resource specifications.
Procedure
When modifying a resource specification, you can modify one or more of the CPU, memory, IOPS, and log disk specifications. Values that are not modified remain unchanged.
Log in to the
systenant of the cluster as therootuser.Modify the resource specification.
The statement is as follows:
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];Example: Modify the resource unit
unit1:obclient> ALTER RESOURCE UNIT unit1 MAX_CPU 15, MEMORY_SIZE '20G', LOG_DISK_SIZE '4G';