Each tenant can run only one load balancing job at a time. If the current running Balance Job does not meet your business requirements, you can cancel the job. If you have initiated a Transfer Partition task but there is an ongoing Balance Job, the Transfer Partition task may be delayed. In this case, you can cancel the current Balance Job first.
Limitations
You can cancel a Balance Job only on the primary cluster (i.e., the primary tenant).
Background information
Each tenant can run only one load balancing job at a time. Load balancing jobs include scaling up, scaling down, migration balancing, and partition balancing. Each load balancing job generates multiple load balancing tasks to perform the specific operations. Canceling a Balance Job will cancel all running tasks under this job.
Cancel a running Balance Job in the sys tenant
Log in to the
systenant of the cluster as therootuser.The following example shows how to connect to the database. Please adjust the connection parameters based on your actual environment.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -AQuery the
CDB_OB_BALANCE_JOBSview to obtain the current running tasks.obclient(root@sys)[oceanbase]> SELECT TENANT_ID, JOB_ID, BALANCE_STRATEGY, JOB_TYPE, STATUS FROM oceanbase.CDB_OB_BALANCE_JOBS WHERE TENANT_ID = 1002;The query result is as follows:
+-----------+--------+----------------------+------------+--------+ | TENANT_ID | JOB_ID | BALANCE_STRATEGY | JOB_TYPE | STATUS | +-----------+--------+----------------------+------------+--------+ | 1002 | 520683 | LS balance by shrink | LS_BALANCE | DOING | +-----------+--------+----------------------+------------+--------+ 1 row in setIf the task does not meet your expectations, you can cancel the Balance Job by executing the following command.
ALTER SYSTEM CANCEL BALANCE JOB TENANT = 'tenant_name';The following example shows how to cancel a Balance Job:
obclient(root@sys)[oceanbase]> ALTER SYSTEM CANCEL BALANCE JOB TENANT ='mysql_tenant';
Cancel a running Balance Job in a user tenant
Connect to the database as the tenant administrator of a MySQL or Oracle tenant.
The following example shows how to connect to the database. Please adjust the connection parameters based on your actual environment.
obclient -h10.xx.xx.xx -P2883 -uroot@mysql_tenant#obdemo -p***** -AQuery the
DBA_OB_BALANCE_JOBSview to obtain the current running tasks.MySQL modeOracle modeThe query statement in MySQL mode is as follows:
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_BALANCE_JOBS;The query statement in Oracle mode is as follows:
obclient [SYS]> SELECT * FROM SYS.DBA_OB_BALANCE_JOBS;If the task does not meet your expectations, you can cancel the Balance Job by executing the following command.
obclient> ALTER SYSTEM CANCEL BALANCE JOB;
