OceanBase Database allows you to enable the arbitration service for a tenant when you create the tenant. You can also enable the arbitration service for a tenant after the tenant is created. This topic describes how to enable the arbitration service for an existing tenant.
Prerequisites
The arbitration service has been deployed in the cluster where the tenant resides.
The tenant must have two or four full-featured replicas.
Procedure
Log on to the
systenant of the cluster as therootuser.Note that you must specify the corresponding fields in the following sample code based on your actual database configurations.
obclient -h10.xx.xx.xx -P2883 -uroot@sys -p***** -AFor more information about how to connect to a database, see Database connection overview (MySQL mode) or Database connection overview (Oracle mode).
Execute the following statement to query the arbitration service status of the tenant.
Sample statement:
obclient [oceanbase]> SELECT * FROM DBA_OB_TENANTS WHERE tenant_name = 'oracle001'; *************************** 1. row *************************** TENANT_ID: 1004 TENANT_NAME: oracle001 TENANT_TYPE: USER CREATE_TIME: 2023-02-06 13:38:27.626314 MODIFY_TIME: 2023-02-06 13:38:45.005930 PRIMARY_ZONE: zone1 LOCALITY: FULL{1}@zone1 PREVIOUS_LOCALITY: NULL COMPATIBILITY_MODE: ORACLE STATUS: NORMAL IN_RECYCLEBIN: NO LOCKED: NO TENANT_ROLE: PRIMARY SWITCHOVER_STATUS: NORMAL SWITCHOVER_EPOCH: 0 SYNC_SCN: 1677665769026296752 REPLAYABLE_SCN: 1677665769026296752 READABLE_SCN: 1677665768858323118 RECOVERY_UNTIL_SCN: 4611686018427387903 LOG_MODE: NOARCHIVELOG ARBITRATION_SERVICE_STATUS: DISABLED 1 row in setThe arbitration service status of the tenant can be:
ENABLED: The arbitration service is enabled for the tenant.DISABLED: The arbitration service is disabled for the tenant.ENABLING: The arbitration service is being enabled for the tenant.DISABLING: The arbitration service is being disabled for the tenant.
The preceding query result shows that the value of the
ARBITRATION_SERVICE_STATUSfield isDISABLED, which indicates that the arbitration service is disabled for the tenant.For more information about the
DBA_OB_TENANTSview, see DBA_OB_TENANTS.Execute the following statement to enable the arbitration service for the tenant:
Syntax:
ALTER TENANT tenant_name [SET] ENABLE_ARBITRATION_SERVICE = true;The
tenant_namefield specifies the name of the tenant for which you want to enable the arbitration service. TheSETkeyword is optional.The following sample statement enables the arbitration service for a tenant named
oracle001:obclient [oceanbase]> ALTER TENANT oracle001 ENABLE_ARBITRATION_SERVICE = true; Query OK, 0 rows affectedQuery the
oceanbase.DBA_OB_TENANTSview to verify whether the arbitration service is enabled for the tenant.Sample statement:
obclient [oceanbase]> SELECT * FROM DBA_OB_TENANTS WHERE tenant_name = 'oracle001'; *************************** 1. row *************************** TENANT_ID: 1004 TENANT_NAME: oracle001 TENANT_TYPE: USER CREATE_TIME: 2023-02-06 13:38:27.626314 MODIFY_TIME: 2023-02-06 13:38:45.005930 PRIMARY_ZONE: zone1 LOCALITY: FULL{1}@zone1 PREVIOUS_LOCALITY: NULL COMPATIBILITY_MODE: ORACLE STATUS: NORMAL IN_RECYCLEBIN: NO LOCKED: NO TENANT_ROLE: PRIMARY SWITCHOVER_STATUS: NORMAL SWITCHOVER_EPOCH: 0 SYNC_SCN: 1677665769026296752 REPLAYABLE_SCN: 1677665769026296752 READABLE_SCN: 1677665768858323118 RECOVERY_UNTIL_SCN: 4611686018427387903 LOG_MODE: NOARCHIVELOG ARBITRATION_SERVICE_STATUS: ENABLED 1 row in setThe preceding query result shows that the value of the
ARBITRATION_SERVICE_STATUSfield isENABLED, which indicates that the arbitration service is enabled for the tenant.After you enable the arbitration service, the existing log streams of the tenant can use the arbitration service, but the new log streams created after the arbitration service is enabled may lack arbitration members and cannot be upgraded or downgraded. This is because a log stream is created in non-strict mode and the arbitration member may not be created. You can execute the following statement to verify whether all log streams of the tenant have arbitration members.
Syntax:
(SELECT distinct ls_id FROM GV$OB_LOG_STAT WHERE tenant_id = tenantid) EXCEPT
(SELECT ls_id FROM GV$OB_LOG_STAT WHERE tenant_id = tenantid AND role = 'LEADER' AND arbitration_member = 'arb_server_ip:arb_server_port');
Parameters:
tenantid: the ID of the tenant for which the arbitration service is enabled.arb_server_ip: the IP address of the server on which the arbitration service is deployed.arb_server_port: the remote procedure call (RPC) port for the arbitration service. By default, Port 2882 is used.
Sample statement:
obclient [oceanbase]> (SELECT distinct ls_id FROM GV$OB_LOG_STAT WHERE tenant_id = 1004) EXCEPT
(SELECT ls_id FROM GV$OB_LOG_STAT where tenant_id = 1004 and role = 'LEADER' and arbitration_member = '100.xx.xx.xx:2882');
Empty set
For more information about the fields in the GV$OB_LOG_STAT view, see GV$OB_LOG_STAT.
If the query result is empty, all log streams have arbitration members, and the arbitration service is available. Otherwise, Root Service will add arbitration members to log streams that lack arbitration members in the background. You can check whether an arbitration member addition task is running by querying the CDB_OB_LS_ARB_REPLICA_TASKS view.
After the task is completed, you can query the CDB_OB_LS_ARB_REPLICA_TASK_HISTORY view to confirm the task execution result. If the task succeeded, arbitration members are added to log streams, and the arbitration service is available. If the task failed, contact OceanBase Technical Support for assistance.
More information
For more information about the arbitration service, see the following topics: