Modify the number of primary zones for a tenant

2024-12-02 03:48:29  Updated

This topic describes how to modify the number of primary zones for a tenant to implement tenant scaling.

Prerequisites

Before you perform a scale-in or scale-out operation on a tenant, you must perform the following steps:

  • Enable load balancing for the tenant.

    The load balancing strategy for a tenant is jointly controlled by the tenant-level parameters enable_rebalance and enable_transfer.

    You can specify the enable_rebalance parameter in the sys tenant to control whether to enable load balancing among tenants, and specify this parameter in a user tenant to control whether to enable load balancing for the current tenant. The default value is true. The setting takes effect immediately without the need to restart the OBServer node.

    You can specify the enable_transfer parameter to control whether to enable the transfer feature for a tenant. The default value is true. The setting takes effect immediately without the need to restart the OBServer node. The enable_transfer parameter depends on the value of the enable_rebalance parameter.

    • If enable_rebalance is set to false, the system does not perform automatic load balancing regardless of whether the value of enable_transfer is true or false.

    • If both enable_rebalance and enable_transfer are set to true, the system automatically adjusts partition distribution during tenant scaling to achieve load balancing.

    • If enable_rebalance is set to true and enable_transfer is set to false, the system cannot initiate transfer operations during tenant scaling, but can implement limited load balancing through log stream migration.

    You can enable load balancing for a tenant in the following ways:

    • Enable load balancing for a specified tenant from the sys tenant

    • Enable load balancing and the transfer feature for a specified tenant from the sys tenant

      ALTER SYSTEM SET enable_rebalance = true TENANT = 'tenant_name';
      
      ALTER SYSTEM SET enable_transfer = true TENANT = 'tenant_name';
      

      These statements only set the values of the enable_rebalance and enable_transfer parameters to true for the specified user tenant.

    • Enable intra-tenant load balancing and the transfer feature for all user tenants from the sys tenant

      ALTER SYSTEM SET enable_rebalance = true TENANT = all_user;
      
      ALTER SYSTEM SET enable_transfer = true TENANT = all_user;
      

      or

      ALTER SYSTEM SET enable_rebalance = true TENANT = all;
      
      ALTER SYSTEM SET enable_transfer = true TENANT = all;
      

      These statements set the values of the enable_rebalance and enable_transfer parameters to true for all user tenants.

      Note

      Starting from OceanBase Database V4.2.1, TENANT = all_user and TENANT = all express the same semantics. If you want an operation to take effect on all user tenants, we recommend that you use TENANT = all_user. TENANT = all will be deprecated.

    • Enable load balancing for a user tenant from the current tenant

      MySQL mode
      Oracle mode

      You can execute the following statements to enable load balancing and the transfer feature for a MySQL tenant:

      ALTER SYSTEM SET enable_rebalance = true;
      
      ALTER SYSTEM SET enable_transfer = true;
      

      You can execute the following statements to enable load balancing and the transfer feature for an Oracle tenant:

      ALTER SYSTEM SET enable_rebalance = 'true';
      
      ALTER SYSTEM SET enable_transfer = 'true';
      

    For more information about the enable_rebalance and enable_transfer parameters, see enable_rebalance and enable_transfer, respectively.

  • Plan resources for the tenant to achieve the desired results.

    For more information, see Plan resources.

Add a primary zone

  1. Log in to the sys tenant of the cluster as the root user.

    obclient -h172.30.xxx.xxx -P2883 -uroot@sys#obdemo -pxxxx -A
    
  2. Access the database named oceanbase.

    use oceanbase;
    
  3. Query the basic information about the mysql001 tenant, such as the locality and primary zone attributes.

    SELECT * FROM oceanbase.DBA_OB_TENANTS WHERE tenant_id = 1006;
    

    The query result is as follows:

    +-----------+-------------+-------------+----------------------------+----------------------------+-------------------+---------------------------------------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+----------+------------+-----------+
    | TENANT_ID | TENANT_NAME | TENANT_TYPE | CREATE_TIME                | MODIFY_TIME                | PRIMARY_ZONE      | LOCALITY                                    | PREVIOUS_LOCALITY | COMPATIBILITY_MODE | STATUS | IN_RECYCLEBIN | LOCKED | TENANT_ROLE | SWITCHOVER_STATUS | SWITCHOVER_EPOCH | SYNC_SCN            | REPLAYABLE_SCN      | READABLE_SCN        | RECOVERY_UNTIL_SCN  | LOG_MODE     | ARBITRATION_SERVICE_STATUS | UNIT_NUM | COMPATIBLE | MAX_LS_ID |
    +-----------+-------------+-------------+----------------------------+----------------------------+-------------------+---------------------------------------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+----------+------------+-----------+
    |      1006 | mysql001    | USER        | 2023-09-25 17:06:51.025654 | 2023-09-25 17:07:31.606415 | zone1;zone2,zone3 | FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3 | NULL              | MYSQL              | NORMAL | NO            | NO     | PRIMARY     | NORMAL            |                0 | 1695633705492686782 | 1695633705492686782 | 1695633705492686782 | 4611686018427387903 | NOARCHIVELOG | DISABLED                   |        2 | 4.2.1.0    |      1002 |
    +-----------+-------------+-------------+----------------------------+----------------------------+-------------------+---------------------------------------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+----------+------------+-----------+
    1 row in set
    
  4. Query the number of resource units of the mysql001 tenant. In this example, the value of UNIT_NUM is 2, indicating that the tenant has two resource units in each zone.

    SELECT * FROM oceanbase.DBA_OB_UNITS WHERE tenant_id = 1006;
    

    The query result is as follows:

    +---------+-----------+--------+------------------+---------------+----------------------------+----------------------------+-------+----------------+----------+---------------------+-----------------------+----------------+----------------+---------+---------+-------------+---------------+---------------------+---------------------+-------------+
    | 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 |
    +---------+-----------+--------+------------------+---------------+----------------------------+----------------------------+-------+----------------+----------+---------------------+-----------------------+----------------+----------------+---------+---------+-------------+---------------+---------------------+---------------------+-------------+
    |    1016 |      1006 | ACTIVE |             1003 |          1006 | 2023-09-25 17:06:38.569419 | 2023-09-25 17:06:51.030929 | zone1 | xxx.xx.xxx.194 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    |    1017 |      1006 | ACTIVE |             1003 |          1007 | 2023-09-25 17:06:38.571540 | 2023-09-25 17:06:51.030929 | zone1 | xxx.xx.xxx.198 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    |    1018 |      1006 | ACTIVE |             1003 |          1006 | 2023-09-25 17:06:38.573614 | 2023-09-25 17:06:51.030929 | zone2 | xxx.xx.xxx.192 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    |    1019 |      1006 | ACTIVE |             1003 |          1007 | 2023-09-25 17:06:38.575723 | 2023-09-25 17:06:51.030929 | zone2 | xxx.xx.xxx.196 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    |    1020 |      1006 | ACTIVE |             1003 |          1006 | 2023-09-25 17:06:38.579946 | 2023-09-25 17:06:51.031986 | zone3 | xxx.xx.xxx.204 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    |    1021 |      1006 | ACTIVE |             1003 |          1007 | 2023-09-25 17:06:38.581002 | 2023-09-25 17:06:51.031986 | zone3 | xxx.xx.xxx.197 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    +---------+-----------+--------+------------------+---------------+----------------------------+----------------------------+-------+----------------+----------+---------------------+-----------------------+----------------+----------------+---------+---------+-------------+---------------+---------------------+---------------------+-------------+
    6 rows in set
    
  5. Modify the PRIMARY_ZONE attribute of the mysql001 tenant to change the number of zones with top priority from 2 to 1.

    ALTER TENANT mysql001 PRIMARY_ZONE='zone1,zone2;zone3'; 
    
  6. View the execution status of the job for adding a primary zone.

    SELECT * FROM oceanbase.DBA_OB_TENANT_JOBS WHERE JOB_TYPE='ALTER_TENANT_PRIMARY_ZONE' AND tenant_id = 1006;
    

    The query result is as follows:

    +--------+---------------------------+------------+-------------+----------+----------------------------+----------------------------+-----------+--------------------------------------------------------+-------------------+----------------+-------------+
    | JOB_ID | JOB_TYPE                  | JOB_STATUS | RESULT_CODE | PROGRESS | START_TIME                 | MODIFY_TIME                | TENANT_ID | SQL_TEXT                                               | EXTRA_INFO        | RS_SVR_IP      | RS_SVR_PORT |
    +--------+---------------------------+------------+-------------+----------+----------------------------+----------------------------+-----------+--------------------------------------------------------+-------------------+----------------+-------------+
    |      4 | ALTER_TENANT_PRIMARY_ZONE | SUCCESS    |           0 |      100 | 2023-09-25 17:26:00.069089 | 2023-09-25 17:26:20.919021 |      1006 | ALTER TENANT mysql001 PRIMARY_ZONE='zone1,zone2;zone3' | zone1;zone2;zone3 | xxx.xx.xxx.196 |        2882 |
    +--------+---------------------------+------------+-------------+----------+----------------------------+----------------------------+-----------+--------------------------------------------------------+-------------------+----------------+-------------+
    1 row in set
    

    In the query result, find the corresponding job record based on the following fields:

    • START_TIME: the time when the job was initiated.
    • SQL_TEXT: the SQL statement corresponding to the job.
    • EXTRA_INFO: the primary zone information before or after the modification.

    If the value of JOB_STATUS is SUCCESS in the corresponding job record, the job for adding the primary zone is successfully executed.

    For more information about the fields in the DBA_OB_TENANT_JOBS view, see DBA_OB_TENANT_JOBS.

  7. Query the basic information of the mysql001 tenant. The zones with the highest priority change from zone1 to zone1,zone2.

    SELECT * FROM oceanbase.DBA_OB_TENANTS WHERE tenant_id = 1006;
    

    The query result is as follows:

    +-----------+-------------+-------------+----------------------------+----------------------------+-------------------+---------------------------------------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+----------+------------+-----------+
    | TENANT_ID | TENANT_NAME | TENANT_TYPE | CREATE_TIME                | MODIFY_TIME                | PRIMARY_ZONE      | LOCALITY                                    | PREVIOUS_LOCALITY | COMPATIBILITY_MODE | STATUS | IN_RECYCLEBIN | LOCKED | TENANT_ROLE | SWITCHOVER_STATUS | SWITCHOVER_EPOCH | SYNC_SCN            | REPLAYABLE_SCN      | READABLE_SCN        | RECOVERY_UNTIL_SCN  | LOG_MODE     | ARBITRATION_SERVICE_STATUS | UNIT_NUM | COMPATIBLE | MAX_LS_ID |
    +-----------+-------------+-------------+----------------------------+----------------------------+-------------------+---------------------------------------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+----------+------------+-----------+
    |      1006 | mysql001    | USER        | 2023-09-25 17:06:51.025654 | 2023-09-25 17:26:00.072130 | zone1,zone2;zone3 | FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3 | NULL              | MYSQL              | NORMAL | NO            | NO     | PRIMARY     | NORMAL            |                0 | 1695634420875364980 | 1695634420875364980 | 1695634420875364980 | 4611686018427387903 | NOARCHIVELOG | DISABLED                   |        2 | 4.2.1.0    |      1004 |
    +-----------+-------------+-------------+----------------------------+----------------------------+-------------------+---------------------------------------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+----------+------------+-----------+
    1 row in set
    
  8. Query the resource units of the mysql001 tenant. In the example blow, the value of UNIT_NUM remains unchanged.

    SELECT * FROM oceanbase.DBA_OB_UNITS WHERE tenant_id = 1006;
    

    The query result is as follows:

    +---------+-----------+--------+------------------+---------------+----------------------------+----------------------------+-------+----------------+----------+---------------------+-----------------------+----------------+----------------+---------+---------+-------------+---------------+---------------------+---------------------+-------------+
    | 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 |
    +---------+-----------+--------+------------------+---------------+----------------------------+----------------------------+-------+----------------+----------+---------------------+-----------------------+----------------+----------------+---------+---------+-------------+---------------+---------------------+---------------------+-------------+
    |    1016 |      1006 | ACTIVE |             1003 |          1006 | 2023-09-25 17:06:38.569419 | 2023-09-25 17:06:51.030929 | zone1 | xxx.xx.xxx.194 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    |    1017 |      1006 | ACTIVE |             1003 |          1007 | 2023-09-25 17:06:38.571540 | 2023-09-25 17:06:51.030929 | zone1 | xxx.xx.xxx.198 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    |    1018 |      1006 | ACTIVE |             1003 |          1006 | 2023-09-25 17:06:38.573614 | 2023-09-25 17:06:51.030929 | zone2 | xxx.xx.xxx.192 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    |    1019 |      1006 | ACTIVE |             1003 |          1007 | 2023-09-25 17:06:38.575723 | 2023-09-25 17:06:51.030929 | zone2 | xxx.xx.xxx.196 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    |    1020 |      1006 | ACTIVE |             1003 |          1006 | 2023-09-25 17:06:38.579946 | 2023-09-25 17:06:51.031986 | zone3 | xxx.xx.xxx.204 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    |    1021 |      1006 | ACTIVE |             1003 |          1007 | 2023-09-25 17:06:38.581002 | 2023-09-25 17:06:51.031986 | zone3 | xxx.xx.xxx.197 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    +---------+-----------+--------+------------------+---------------+----------------------------+----------------------------+-------+----------------+----------+---------------------+-----------------------+----------------+----------------+---------+---------+-------------+---------------+---------------------+---------------------+-------------+
    6 rows in set
    

In the preceding example, the number of primary zones is changed from 1 to 2 for the mysql001 tenant. The tenant has two resource units in each zone before the change. After the change, the tenant still has two resource units in each zone but the number of primary zones changes from 1 to 2.

Remove a primary zone

  1. Log in to the sys tenant of the cluster as the root user.

    obclient -h172.30.xxx.xxx -P2883 -uroot@sys#obdemo -pxxxx -A
    
  2. Access the database named oceanbase.

    use oceanbase;
    
  3. Query the basic information about the mysql001 tenant, such as the locality and primary zone attributes.

    SELECT * FROM oceanbase.DBA_OB_TENANTS WHERE tenant_id = 1006;
    

    The query result is as follows:

    +-----------+-------------+-------------+----------------------------+----------------------------+-------------------+---------------------------------------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+----------+------------+-----------+
    | TENANT_ID | TENANT_NAME | TENANT_TYPE | CREATE_TIME                | MODIFY_TIME                | PRIMARY_ZONE      | LOCALITY                                    | PREVIOUS_LOCALITY | COMPATIBILITY_MODE | STATUS | IN_RECYCLEBIN | LOCKED | TENANT_ROLE | SWITCHOVER_STATUS | SWITCHOVER_EPOCH | SYNC_SCN            | REPLAYABLE_SCN      | READABLE_SCN        | RECOVERY_UNTIL_SCN  | LOG_MODE     | ARBITRATION_SERVICE_STATUS | UNIT_NUM | COMPATIBLE | MAX_LS_ID |
    +-----------+-------------+-------------+----------------------------+----------------------------+-------------------+---------------------------------------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+----------+------------+-----------+
    |      1006 | mysql001    | USER        | 2023-09-25 17:06:51.025654 | 2023-09-25 17:26:00.072130 | zone1,zone2;zone3 | FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3 | NULL              | MYSQL              | NORMAL | NO            | NO     | PRIMARY     | NORMAL            |                0 | 1695634420875364980 | 1695634420875364980 | 1695634420875364980 | 4611686018427387903 | NOARCHIVELOG | DISABLED                   |        2 | 4.2.1.0    |      1004 |
    +-----------+-------------+-------------+----------------------------+----------------------------+-------------------+---------------------------------------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+----------+------------+-----------+
    1 row in set
    
  4. Query the number of resource units of the mysql001 tenant. In this example, the value of UNIT_NUM is 2, indicating that the tenant has two resource units in each zone.

    SELECT * FROM oceanbase.DBA_OB_UNITS WHERE tenant_id = 1006;
    

    The query result is as follows:

    +---------+-----------+--------+------------------+---------------+----------------------------+----------------------------+-------+----------------+----------+---------------------+-----------------------+----------------+----------------+---------+---------+-------------+---------------+---------------------+---------------------+-------------+
    | 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 |
    +---------+-----------+--------+------------------+---------------+----------------------------+----------------------------+-------+----------------+----------+---------------------+-----------------------+----------------+----------------+---------+---------+-------------+---------------+---------------------+---------------------+-------------+
    |    1016 |      1006 | ACTIVE |             1003 |          1006 | 2023-09-25 17:06:38.569419 | 2023-09-25 17:06:51.030929 | zone1 | xxx.xx.xxx.194 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    |    1017 |      1006 | ACTIVE |             1003 |          1007 | 2023-09-25 17:06:38.571540 | 2023-09-25 17:06:51.030929 | zone1 | xxx.xx.xxx.198 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    |    1018 |      1006 | ACTIVE |             1003 |          1006 | 2023-09-25 17:06:38.573614 | 2023-09-25 17:06:51.030929 | zone2 | xxx.xx.xxx.192 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    |    1019 |      1006 | ACTIVE |             1003 |          1007 | 2023-09-25 17:06:38.575723 | 2023-09-25 17:06:51.030929 | zone2 | xxx.xx.xxx.196 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    |    1020 |      1006 | ACTIVE |             1003 |          1006 | 2023-09-25 17:06:38.579946 | 2023-09-25 17:06:51.031986 | zone3 | xxx.xx.xxx.204 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    |    1021 |      1006 | ACTIVE |             1003 |          1007 | 2023-09-25 17:06:38.581002 | 2023-09-25 17:06:51.031986 | zone3 | xxx.xx.xxx.197 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    +---------+-----------+--------+------------------+---------------+----------------------------+----------------------------+-------+----------------+----------+---------------------+-----------------------+----------------+----------------+---------+---------+-------------+---------------+---------------------+---------------------+-------------+
    6 rows in set
    
  5. Modify the PRIMARY_ZONE attribute of the mysql001 tenant to change the number of zones with top priority from 2 to 1.

    ALTER TENANT mysql001 PRIMARY_ZONE='zone1;zone2,zone3'; 
    
  6. View the execution status of the job for reducing primary zones.

    SELECT * FROM oceanbase.DBA_OB_TENANT_JOBS WHERE JOB_TYPE='ALTER_TENANT_PRIMARY_ZONE' AND tenant_id = 1006;
    

    The query result is as follows:

    +--------+---------------------------+------------+-------------+----------+----------------------------+----------------------------+-----------+--------------------------------------------------------+-------------------+----------------+-------------+
    | JOB_ID | JOB_TYPE                  | JOB_STATUS | RESULT_CODE | PROGRESS | START_TIME                 | MODIFY_TIME                | TENANT_ID | SQL_TEXT                                               | EXTRA_INFO        | RS_SVR_IP      | RS_SVR_PORT |
    +--------+---------------------------+------------+-------------+----------+----------------------------+----------------------------+-----------+--------------------------------------------------------+-------------------+----------------+-------------+
    |      4 | ALTER_TENANT_PRIMARY_ZONE | SUCCESS    |           0 |      100 | 2023-09-25 17:26:00.069089 | 2023-09-25 17:26:20.919021 |      1006 | ALTER TENANT mysql001 PRIMARY_ZONE='zone1,zone2;zone3' | zone1;zone2;zone3 | xxx.xx.xxx.196 |        2882 |
    |      5 | ALTER_TENANT_PRIMARY_ZONE | SUCCESS    |           0 |      100 | 2023-09-25 17:41:44.412459 | 2023-09-25 17:41:54.965873 |      1006 | ALTER TENANT mysql001 PRIMARY_ZONE='zone1;zone2,zone3' | zone1,zone2;zone3 | xxx.xx.xxx.196 |        2882 |
    +--------+---------------------------+------------+-------------+----------+----------------------------+----------------------------+-----------+--------------------------------------------------------+-------------------+----------------+-------------+
    2 rows in set
    

    In the query result, find the corresponding job record based on the following fields:

    • START_TIME: the time when the job was initiated.
    • SQL_TEXT: the SQL statement corresponding to the job.
    • EXTRA_INFO: the primary zone information before or after the modification.

    If the value of JOB_STATUS is SUCCESS in the corresponding job record, the job for reducing primary zones is successfully executed.

    For more information about the fields in the DBA_OB_TENANT_JOBS view, see DBA_OB_TENANT_JOBS.

  7. Query the basic information of the mysql001 tenant and confirm that the value of the PRIMARY_ZONE attribute is changed from zone1,zone2 to zone1.

    SELECT * FROM oceanbase.DBA_OB_TENANTS WHERE tenant_id = 1006;
    

    The query result is as follows:

    +-----------+-------------+-------------+----------------------------+----------------------------+-------------------+---------------------------------------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+----------+------------+-----------+
    | TENANT_ID | TENANT_NAME | TENANT_TYPE | CREATE_TIME                | MODIFY_TIME                | PRIMARY_ZONE      | LOCALITY                                    | PREVIOUS_LOCALITY | COMPATIBILITY_MODE | STATUS | IN_RECYCLEBIN | LOCKED | TENANT_ROLE | SWITCHOVER_STATUS | SWITCHOVER_EPOCH | SYNC_SCN            | REPLAYABLE_SCN      | READABLE_SCN        | RECOVERY_UNTIL_SCN  | LOG_MODE     | ARBITRATION_SERVICE_STATUS | UNIT_NUM | COMPATIBLE | MAX_LS_ID |
    +-----------+-------------+-------------+----------------------------+----------------------------+-------------------+---------------------------------------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+----------+------------+-----------+
    |      1006 | mysql001    | USER        | 2023-09-25 17:06:51.025654 | 2023-09-25 17:41:44.412137 | zone1;zone2,zone3 | FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3 | NULL              | MYSQL              | NORMAL | NO            | NO     | PRIMARY     | NORMAL            |                0 | 1695634988660461888 | 1695634988660461888 | 1695634988660461888 | 4611686018427387903 | NOARCHIVELOG | DISABLED                   |        2 | 4.2.1.0    |      1004 |
    +-----------+-------------+-------------+----------------------------+----------------------------+-------------------+---------------------------------------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+----------+------------+-----------+
    1 row in set
    
  8. Query information about the resource units of the mysql001 tenant again. The value of UNIT_NUM remains unchanged before and after the modification.

    SELECT * FROM oceanbase.DBA_OB_UNITS WHERE tenant_id = 1006;
    

    The query result is as follows:

    +---------+-----------+--------+------------------+---------------+----------------------------+----------------------------+-------+----------------+----------+---------------------+-----------------------+----------------+----------------+---------+---------+-------------+---------------+---------------------+---------------------+-------------+
    | 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 |
    +---------+-----------+--------+------------------+---------------+----------------------------+----------------------------+-------+----------------+----------+---------------------+-----------------------+----------------+----------------+---------+---------+-------------+---------------+---------------------+---------------------+-------------+
    |    1016 |      1006 | ACTIVE |             1003 |          1006 | 2023-09-25 17:06:38.569419 | 2023-09-25 17:06:51.030929 | zone1 | xxx.xx.xxx.194 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    |    1017 |      1006 | ACTIVE |             1003 |          1007 | 2023-09-25 17:06:38.571540 | 2023-09-25 17:06:51.030929 | zone1 | xxx.xx.xxx.198 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    |    1018 |      1006 | ACTIVE |             1003 |          1006 | 2023-09-25 17:06:38.573614 | 2023-09-25 17:06:51.030929 | zone2 | xxx.xx.xxx.192 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    |    1019 |      1006 | ACTIVE |             1003 |          1007 | 2023-09-25 17:06:38.575723 | 2023-09-25 17:06:51.030929 | zone2 | xxx.xx.xxx.196 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    |    1020 |      1006 | ACTIVE |             1003 |          1006 | 2023-09-25 17:06:38.579946 | 2023-09-25 17:06:51.031986 | zone3 | xxx.xx.xxx.204 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    |    1021 |      1006 | ACTIVE |             1003 |          1007 | 2023-09-25 17:06:38.581002 | 2023-09-25 17:06:51.031986 | zone3 | xxx.xx.xxx.197 |     2882 | NULL                |                  NULL | NULL           |           1002 |       1 |       1 |  5368709120 |   16106127360 | 9223372036854775807 | 9223372036854775807 |           1 |
    +---------+-----------+--------+------------------+---------------+----------------------------+----------------------------+-------+----------------+----------+---------------------+-----------------------+----------------+----------------+---------+---------+-------------+---------------+---------------------+---------------------+-------------+
    6 rows in set
    

In the preceding example, the number of primary zones is changed from 2 to 1 for the mysql001 tenant. The tenant has two resource units in each zone before the change. After the change, the tenant still has two resource units in each zone but the number of primary zones changes from 2 to 1.

Contact Us