If a load balancing job is running for a tenant and there is an urgent change that needs to be executed, you can choose to pause the current load balancing job to prevent it from affecting the urgent change. Once the urgent change is completed, you can resume the load balancing job to continue its execution.
Limitations
You can pause or resume a load balancing job only on the primary database (that is, the primary tenant).
When suspending or resuming a load balancing job, the status of the load balancing job must not be
CANCELING.
Suspend the ongoing load balancing job
Suspend a load balancing job on a user tenant from the sys tenant
Log in to the
systenant of the cluster as therootuser.The following example shows how to connect to the database. Replace the actual environment parameters in the example.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -AObtain tenant-related information.
obclient(root@sys)[oceanbase]> SELECT TENANT_ID, TENANT_NAME, TENANT_ROLE FROM oceanbase.DBA_OB_TENANTS WHERE tenant_name = 'mq_t1';The query result is as follows:
+-------------+-----------+-------------+ | TENANT_NAME | TENANT_ID | TENANT_ROLE | +-------------+-----------+-------------+ | mq_t1 | 1002 | PRIMARY | +-------------+-----------+-------------+ 1 row in setQuery the
CDB_OB_BALANCE_JOBSview to obtain the current running job and its status.obclient(root@sys)[oceanbase]> SELECT TENANT_ID, JOB_ID, JOB_TYPE, STATUS FROM oceanbase.CDB_OB_BALANCE_JOBS WHERE TENANT_ID = 1002;The query result is as follows:
+-----------+--------+--------------------+--------+ | TENANT_ID | JOB_ID | JOB_TYPE | STATUS | +-----------+--------+--------------------+--------+ | 1002 | 62944 | TRANSFER_PARTITION | DOING | +-----------+--------+--------------------+--------+ 1 row in setBased on the query result, the status of the current load balancing job is
DOING, notCANCELING. You can suspend the job.Execute the following statement to suspend the load balancing job.
ALTER SYSTEM SUSPEND BALANCE JOB TENANT = 'tenant_name';Example:
obclient(root@sys)[oceanbase]> ALTER SYSTEM SUSPEND BALANCE JOB TENANT ='mq_t1';After the execution succeeds, query the
CDB_OB_BALANCE_JOBSview again. You can see that the status of the current job changes toSUSPEND.obclient(root@sys)[oceanbase]> SELECT TENANT_ID, JOB_ID, JOB_TYPE, STATUS FROM oceanbase.CDB_OB_BALANCE_JOBS WHERE TENANT_ID = 1002;The query result is as follows:
+-----------+--------+--------------------+---------+ | TENANT_ID | JOB_ID | JOB_TYPE | STATUS | +-----------+--------+--------------------+---------+ | 1002 | 62944 | TRANSFER_PARTITION | SUSPEND | +-----------+--------+--------------------+---------+ 1 row in set
Suspend the load balancing job on the current tenant from the user tenant
Connect to the database as the tenant administrator of a MySQL-compatible or Oracle-compatible tenant.
The following example shows how to connect to the database. Please replace the parameters with those in your environment.
obclient -h10.xx.xx.xx -P2883 -uroot@mysql_tenant#obdemo -p***** -AQuery the
DBA_OB_BALANCE_JOBSview to obtain the current running job and its status.MySQL-compatible modeOracle-compatible modeThe query statement in MySQL-compatible mode is as follows:
obclient(root@mysql001)[oceanbase]> SELECT JOB_ID, JOB_TYPE, STATUS FROM oceanbase.DBA_OB_BALANCE_JOBS;The query statement in Oracle-compatible mode is as follows:
obclient(SYS@oracle001)[SYS]> SELECT JOB_ID, JOB_TYPE, STATUS FROM SYS.DBA_OB_BALANCE_JOBS;The query result is as follows:
+--------+--------------------+---------+ | JOB_ID | JOB_TYPE | STATUS | +--------+--------------------+---------+ | 62944 | TRANSFER_PARTITION | DOING | +--------+--------------------+---------+ 1 row in setBased on the query result, the status of the current load balancing job is
DOING, notCANCELING. You can suspend the job.Execute the following statement to pause the load balancing job.
obclient> ALTER SYSTEM SUSPEND BALANCE JOB;After the execution succeeds, query the
DBA_OB_BALANCE_JOBSview again. You can see that the status of the current job changes toSUSPEND.MySQL-compatible modeOracle-compatible modeThe query statement in MySQL-compatible mode is as follows:
obclient(root@mysql001)[oceanbase]> SELECT JOB_ID, JOB_TYPE, STATUS FROM oceanbase.DBA_OB_BALANCE_JOBS;The query statement in Oracle-compatible mode is as follows:
obclient(SYS@oracle001)[SYS]> SELECT JOB_ID, JOB_TYPE, STATUS FROM SYS.DBA_OB_BALANCE_JOBS;The query result is as follows:
+--------+--------------------+---------+ | JOB_ID | JOB_TYPE | STATUS | +--------+--------------------+---------+ | 62944 | TRANSFER_PARTITION | SUSPEND | +--------+--------------------+---------+ 1 row in set
Resume a suspended load balancing job
Resume a suspended load balancing job of a user tenant from the sys tenant
Log in to the
systenant of the cluster as therootuser.The following example shows how to connect to the database. Replace the actual environment parameters as needed.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -AObtain tenant-related information.
obclient(root@sys)[oceanbase]> SELECT TENANT_ID, TENANT_NAME, TENANT_ROLE FROM oceanbase.DBA_OB_TENANTS WHERE tenant_name = 'mq_t1';The query result is as follows:
+-------------+-----------+-------------+ | TENANT_NAME | TENANT_ID | TENANT_ROLE | +-------------+-----------+-------------+ | mq_t1 | 1002 | PRIMARY | +-------------+-----------+-------------+ 1 row in setQuery the
CDB_OB_BALANCE_JOBSview to obtain the current suspended job and its status.obclient(root@sys)[oceanbase]> SELECT TENANT_ID, JOB_ID, JOB_TYPE, STATUS FROM oceanbase.CDB_OB_BALANCE_JOBS WHERE TENANT_ID = 1002;The query result is as follows:
+-----------+--------+--------------------+---------+ | TENANT_ID | JOB_ID | JOB_TYPE | STATUS | +-----------+--------+--------------------+---------+ | 1002 | 62944 | TRANSFER_PARTITION | SUSPEND | +-----------+--------+--------------------+---------+ 1 row in setBased on the query result, the status of the current load balancing job is
SUSPEND.Execute the following statement to resume the suspended load balancing job.
ALTER SYSTEM RESUME BALANCE JOB TENANT = 'tenant_name';Example:
obclient(root@sys)[oceanbase]> ALTER SYSTEM RESUME BALANCE JOB TENANT ='mq_t1';After the execution succeeds, query the
CDB_OB_BALANCE_JOBSview again. You can see that the status of the current job changes toDOING.obclient(root@sys)[oceanbase]> SELECT TENANT_ID, JOB_ID, JOB_TYPE, STATUS FROM oceanbase.CDB_OB_BALANCE_JOBS WHERE TENANT_ID = 1002;The query result is as follows:
+-----------+--------+--------------------+---------+ | TENANT_ID | JOB_ID | JOB_TYPE | STATUS | +-----------+--------+--------------------+---------+ | 1002 | 62944 | TRANSFER_PARTITION | DOING | +-----------+--------+--------------------+---------+ 1 row in set
Resume the suspended load balancing job in the current tenant from the user tenant
Connect to the database as the tenant administrator of a MySQL-compatible or Oracle-compatible tenant.
The following example shows how to connect to the database. Please replace the actual environment parameters.
obclient -h10.xx.xx.xx -P2883 -uroot@mysql_tenant#obdemo -p***** -AQuery the
DBA_OB_BALANCE_JOBSview to obtain the current suspended job and its status.MySQL-compatible modeOracle-compatible modeThe query statement in MySQL-compatible mode is as follows:
obclient(root@mysql001)[oceanbase]> SELECT JOB_ID, JOB_TYPE, STATUS FROM oceanbase.DBA_OB_BALANCE_JOBS;The query statement in Oracle-compatible mode is as follows:
obclient(SYS@oracle001)[SYS]> SELECT JOB_ID, JOB_TYPE, STATUS FROM SYS.DBA_OB_BALANCE_JOBS;The query result is as follows:
+--------+--------------------+---------+ | JOB_ID | JOB_TYPE | STATUS | +--------+--------------------+---------+ | 62944 | TRANSFER_PARTITION | SUSPEND | +--------+--------------------+---------+ 1 row in setBased on the query result, the status of the current load balancing job is
SUSPEND.Execute the following statement to resume the suspended load balancing job.
obclient> ALTER SYSTEM RESUME BALANCE JOB;After the execution succeeds, query the
DBA_OB_BALANCE_JOBSview again. You can see that the status of the current job changes toDOING.MySQL-compatible modeOracle-compatible modeThe query statement in MySQL-compatible mode is as follows:
obclient(root@mysql001)[oceanbase]> SELECT JOB_ID, JOB_TYPE, STATUS FROM oceanbase.DBA_OB_BALANCE_JOBS;The query statement in Oracle-compatible mode is as follows:
obclient(SYS@oracle001)[SYS]> SELECT JOB_ID, JOB_TYPE, STATUS FROM SYS.DBA_OB_BALANCE_JOBS;The query result is as follows:
+--------+--------------------+---------+ | JOB_ID | JOB_TYPE | STATUS | +--------+--------------------+---------+ | 62944 | TRANSFER_PARTITION | DOING | +--------+--------------------+---------+ 1 row in set