Tenant scaling aims to improve or reduce the service capabilities of the tenant, including the computing and storage capacities. To meet this purpose, you can improve the service capabilities of a single node or add service nodes. This topic describes how to modify the number of resource units to increase or decrease service nodes to improve or reduce the overall service capabilities of a tenant, thereby implementing tenant scaling.
Limitation
You cannot decrease the number of resource units in OceanBase Database V4.0.0.
Prerequisites
Before you perform a scaling operation on a tenant, you must perform the following steps:
If the tenant is deleted, delete the resource pool of the tenant to release resources. Resources in an idle resource pool are also considered occupied resources.
For more information about how to drop a resource pool, see Drop a resource pool.
Perform a round of minor compaction to release the occupied memory resources.
For more information about how to manually initiate a minor compaction, see Manually initiate a minor compaction.
View the allocation of resources in the cluster to understand resource usage.
For more information about how to view the total resources and resource allocation for nodes in a cluster, see View resource information of a cluster.
Procedure
To adjust the number of resource units for the mq_t1 tenant, perform the following steps:
Log on to the sys tenant of the cluster as the root user.
obclient -h172.30.xxx.xxx -P2883 -uroot@sys -pxxxx -AExecute the following statement to go to the database named
oceanbase:obclient>use oceanbase;View information about the
mq_t1to obtain itsTENANT_ID.obclient> SELECT * FROM oceanbase.DBA_OB_TENANTS WHERE TENANT_NAME = 'mq_t1'; +-----------+-------------+-------------+----------------------------+----------------------------+----------------------------------------+------------------------------------------------------------------+-------------------+--------------------+--------+---------------+--------+ | TENANT_ID | TENANT_NAME | TENANT_TYPE | CREATE_TIME | MODIFY_TIME | PRIMARY_ZONE | LOCALITY | PREVIOUS_LOCALITY | COMPATIBILITY_MODE | STATUS | IN_RECYCLEBIN | LOCKED | +-----------+-------------+-------------+----------------------------+----------------------------+----------------------------------------+------------------------------------------------------------------+-------------------+--------------------+--------+---------------+--------+ | 1004 | mq_t1 | USER | 2023-01-04 18:32:08.212745 | 2023-01-04 18:32:33.343667 | sa128_obv4_1;sa128_obv4_2,sa128_obv4_3 | FULL{1}@sa128_obv4_1, FULL{1}@sa128_obv4_2, FULL{1}@sa128_obv4_3 | NULL | MYSQL | NORMAL | NO | NO | +-----------+-------------+-------------+----------------------------+----------------------------+----------------------------------------+------------------------------------------------------------------+-------------------+--------------------+--------+---------------+--------+ 1 row in setView the resource units of the
mq_t1tenant.obclient> SELECT * FROM oceanbase.DBA_OB_UNITS WHERE TENANT_ID = 1004; +---------+-----------+--------+------------------+---------------+----------------------------+----------------------------+--------------+------------+----------+---------------------+-----------------------+----------------+----------------+---------+---------+-------------+---------------+----------+----------+-------------+ | UNIT_ID | TENANT_ID | STATUS | RESOURCE_POOL_ID | UNIT_GROUP_ID | CREATE_TIME | MODIFY_TIME | ZONE | SVR_IP | SVR_PORT | MIGRATE_FROM_SVR_IP | MIGRATE_FROM_SVR_PORT | MANUAL_MIGRATE | UNIT_CONFIG_ID | MAX_CPU | MIN_CPU | MEMORY_SIZE | LOG_DISK_SIZE | MAX_IOPS | MIN_IOPS | IOPS_WEIGHT | +---------+-----------+--------+------------------+---------------+----------------------------+----------------------------+--------------+------------+----------+---------------------+-----------------------+----------------+----------------+---------+---------+-------------+---------------+----------+----------+-------------+ | 1004 | 1004 | ACTIVE | 1005 | 1003 | 2023-01-04 11:48:36.582413 | 2023-01-04 18:32:08.215935 | sa128_obv4_1 | xx.xx.xx.47 | 2882 | NULL | NULL | NULL | 1006 | 3 | 3 | 12884901888 | 38654705664 | 30000 | 30000 | 3 | | 1005 | 1004 | ACTIVE | 1005 | 1003 | 2023-01-04 11:48:36.591414 | 2023-01-04 18:32:08.215935 | sa128_obv4_2 | xx.xx.xx.81 | 2882 | NULL | NULL | NULL | 1006 | 3 | 3 | 12884901888 | 38654705664 | 30000 | 30000 | 3 | | 1006 | 1004 | ACTIVE | 1005 | 1003 | 2023-01-04 14:13:36.980799 | 2023-01-04 18:32:08.217005 | sa128_obv4_3 | xx.xx.xx.19 | 2882 | NULL | NULL | NULL | 1006 | 3 | 3 | 12884901888 | 38654705664 | 30000 | 30000 | 3 | +---------+-----------+--------+------------------+---------------+----------------------------+----------------------------+--------------+------------+----------+---------------------+-----------------------+----------------+----------------+---------+---------+-------------+---------------+----------+----------+-------------+ 3 rows in setView the current log streams of the
mq_t1tenant.obclient> SELECT * FROM oceanbase.CDB_OB_LS WHERE TENANT_ID = 1004; +-----------+-------+--------+----------------------------------------+---------------+-------------+---------------------+----------+---------------------+---------------------+ | TENANT_ID | LS_ID | STATUS | PRIMARY_ZONE | UNIT_GROUP_ID | LS_GROUP_ID | CREATE_SCN | DROP_SCN | SYNC_SCN | READABLE_SCN | +-----------+-------+--------+----------------------------------------+---------------+-------------+---------------------+----------+---------------------+---------------------+ | 1004 | 1 | NORMAL | sa128_obv4_1;sa128_obv4_2,sa128_obv4_3 | 0 | 0 | NULL | NULL | 1672847276585423284 | 1672847276297748492 | | 1004 | 1001 | NORMAL | sa128_obv4_1;sa128_obv4_2,sa128_obv4_3 | 1003 | 1001 | 1672828353411747395 | NULL | 1672847283647357012 | 1672847283446006907 | +-----------+-------+--------+----------------------------------------+---------------+-------------+---------------------+----------+---------------------+---------------------+ 2 rows in setChange the value of
UNIT_NUMto 2 for themq_t1tenant.obclient> ALTER RESOURCE TENANT mq_t1 UNIT_NUM = 2;View the resource units of the
mq_t1tenant after modification.obclient> SELECT * FROM oceanbase.DBA_OB_UNITS WHERE TENANT_ID = 1004; +---------+-----------+--------+------------------+---------------+----------------------------+----------------------------+--------------+-------------+----------+---------------------+-----------------------+----------------+----------------+---------+---------+-------------+---------------+----------+----------+-------------+ | UNIT_ID | TENANT_ID | STATUS | RESOURCE_POOL_ID | UNIT_GROUP_ID | CREATE_TIME | MODIFY_TIME | ZONE | SVR_IP | SVR_PORT | MIGRATE_FROM_SVR_IP | MIGRATE_FROM_SVR_PORT | MANUAL_MIGRATE | UNIT_CONFIG_ID | MAX_CPU | MIN_CPU | MEMORY_SIZE | LOG_DISK_SIZE | MAX_IOPS | MIN_IOPS | IOPS_WEIGHT | +---------+-----------+--------+------------------+---------------+----------------------------+----------------------------+--------------+-------------+----------+---------------------+-----------------------+----------------+----------------+---------+---------+-------------+---------------+----------+----------+-------------+ | 1004 | 1004 | ACTIVE | 1005 | 1003 | 2023-01-04 11:48:36.582413 | 2023-01-04 18:32:08.215935 | sa128_obv4_1 | xx.xx.xx.47 | 2882 | NULL | NULL | NULL | 1006 | 3 | 3 | 12884901888 | 38654705664 | 30000 | 30000 | 3 | | 1005 | 1004 | ACTIVE | 1005 | 1003 | 2023-01-04 11:48:36.591414 | 2023-01-04 18:32:08.215935 | sa128_obv4_2 | xx.xx.xx.81 | 2882 | NULL | NULL | NULL | 1006 | 3 | 3 | 12884901888 | 38654705664 | 30000 | 30000 | 3 | | 1006 | 1004 | ACTIVE | 1005 | 1003 | 2023-01-04 14:13:36.980799 | 2023-01-04 18:32:08.217005 | sa128_obv4_3 | xx.xx.xx.19 | 2882 | NULL | NULL | NULL | 1006 | 3 | 3 | 12884901888 | 38654705664 | 30000 | 30000 | 3 | | 1007 | 1004 | ACTIVE | 1005 | 1004 | 2023-01-04 23:50:57.989966 | 2023-01-04 23:50:57.989966 | sa128_obv4_1 | xx.xx.xx.43 | 2882 | NULL | NULL | NULL | 1006 | 3 | 3 | 12884901888 | 38654705664 | 30000 | 30000 | 3 | | 1008 | 1004 | ACTIVE | 1005 | 1004 | 2023-01-04 23:50:57.995273 | 2023-01-04 23:50:57.995273 | sa128_obv4_2 | xx.xx.xx.106 | 2882 | NULL | NULL | NULL | 1006 | 3 | 3 | 12884901888 | 38654705664 | 30000 | 30000 | 3 | | 1009 | 1004 | ACTIVE | 1005 | 1004 | 2023-01-04 23:50:57.997360 | 2023-01-04 23:50:57.997360 | sa128_obv4_3 | xx.xx.xx.158 | 2882 | NULL | NULL | NULL | 1006 | 3 | 3 | 12884901888 | 38654705664 | 30000 | 30000 | 3 | +---------+-----------+--------+------------------+---------------+----------------------------+----------------------------+--------------+-------------+----------+---------------------+-----------------------+----------------+----------------+---------+---------+-------------+---------------+----------+----------+-------------+ 6 rows in setView the log streams of the
mq_t1tenant after modification.obclient> SELECT * FROM oceanbase.CDB_OB_LS WHERE TENANT_ID = 1004; +-----------+-------+--------+----------------------------------------+---------------+-------------+---------------------+----------+---------------------+---------------------+ | TENANT_ID | LS_ID | STATUS | PRIMARY_ZONE | UNIT_GROUP_ID | LS_GROUP_ID | CREATE_SCN | DROP_SCN | SYNC_SCN | READABLE_SCN | +-----------+-------+--------+----------------------------------------+---------------+-------------+---------------------+----------+---------------------+---------------------+ | 1004 | 1 | NORMAL | sa128_obv4_1;sa128_obv4_2,sa128_obv4_3 | 0 | 0 | NULL | NULL | 1672847476919847432 | 1672847476694110593 | | 1004 | 1001 | NORMAL | sa128_obv4_1;sa128_obv4_2,sa128_obv4_3 | 1003 | 1001 | 1672828353411747395 | NULL | 1672847481926946171 | 1672847481725653432 | | 1004 | 1002 | NORMAL | sa128_obv4_1;sa128_obv4_2,sa128_obv4_3 | 1004 | 1002 | 1672847466822734122 | NULL | 1672847481906918109 | 1672847481705364375 | +-----------+-------+--------+----------------------------------------+---------------+-------------+---------------------+----------+---------------------+---------------------+ 3 rows in set
The query result shows that the number of resource units is changed from 1 to 2 for the mq_t1 tenant. Before modification, the tenant has one resource unit in each zone and one log stream. After modification, the tenant has two resource units in each zone and two log streams. The tenant is scaled up.