Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support the arbitration service.
You can enable the arbitration service for a tenant when you create the tenant. For more information, see Create a tenant. If the arbitration service is not enabled for the tenant, you can enable it after the tenant is created. This topic describes how to enable the arbitration service for an existing tenant.
Prerequisites
Make sure that the arbitration service is deployed in the current cluster. For more information, see Deploy an OceanBase cluster with two replicas and the arbitration service.
Before you enable the arbitration service, make sure that the Locality of the tenant to be enabled is 2F or 4F. Currently, only tenants with a Locality of 2F or 4F can enable the arbitration service.
Note
Enabling the arbitration service only requires that the number of F replicas in the Locality of the tenant meets the requirements. The number of R replicas in the Locality of the tenant is not limited. For example, the arbitration service can be enabled for a tenant whose Locality is
F@z1,F@z2orF@z1,F@z2,R@z3.
Procedure
Log in to the
systenant of the cluster as therootuser.Here is an example of connecting to the database. Please replace the placeholders with the actual values in your environment.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -AFor more information about how to connect to the database, see Overview of database connection methods (MySQL mode) and Overview of database connection methods (Oracle mode).
Execute the following command to view the communication status of each node in the cluster.
SELECT * FROM oceanbase.GV$OB_ARBITRATION_SERVICE_STATUS;The query result is as follows.
+----------------+----------+-----------------------------+----------+ | SVR_IP | SVR_PORT | ARBITRATION_SERVICE_ADDRESS | STATUS | +----------------+----------+-----------------------------+----------+ | xx.xx.xx.197 | 2882 | xx.xx.xx.192:2882 | ACTIVE | | xx.xx.xx.194 | 2882 | xx.xx.xx.192:2882 | ACTIVE | +----------------+----------+-----------------------------+----------+ 2 rows in setBased on the value of the
STATUSfield in the query result, you can determine the communication status between each node and the arbitration service:ACTIVE: The arbitration service communicates normally with the node. You can enable the arbitration service for the tenant only when all nodes communicate normally with the arbitration service.INACTIVE: The arbitration service cannot communicate with the node. You cannot enable the arbitration service for the tenant. You need to check the network communication between the node and the arbitration service.
Execute the following command to view the arbitration service status of the tenant.
SELECT * FROM oceanbase.DBA_OB_TENANTS WHERE tenant_name = 'oracle001'\GThe query result is as follows.
*************************** 1. row *************************** TENANT_ID: 1004 TENANT_NAME: oracle001 TENANT_TYPE: USER CREATE_TIME: 2025-06-26 19:40:21.457857 MODIFY_TIME: 2025-06-27 13:51:47.053502 PRIMARY_ZONE: zone1;zone2 LOCALITY: FULL{1}@zone1, FULL{1}@zone2 PREVIOUS_LOCALITY: NULL COMPATIBILITY_MODE: ORACLE STATUS: NORMAL IN_RECYCLEBIN: NO LOCKED: NO TENANT_ROLE: PRIMARY SWITCHOVER_STATUS: NORMAL SWITCHOVER_EPOCH: 0 SYNC_SCN: 1687845116605766616 REPLAYABLE_SCN: 1687845116605766616 READABLE_SCN: 1687845116605766616 RECOVERY_UNTIL_SCN: 4611686018427387903 LOG_MODE: NOARCHIVELOG ARBITRATION_SERVICE_STATUS: DISABLED UNIT_NUM: 1 COMPATIBLE: 4.3.5.0 MAX_LS_ID: 1002 RESTORE_DATA_MODE: NORMAL COMMENT: 1 row in setThe arbitration service of the tenant can be in one of the following states:
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.
Based on the query result, the
ARBITRATION_SERVICE_STATUScolumn 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 command to enable the arbitration service for the tenant.
The statement is as follows:
ALTER TENANT tenant_name [SET] ENABLE_ARBITRATION_SERVICE = true;In this statement,
tenant_namespecifies the name of the tenant for which you want to enable the arbitration service, andSETis an optional keyword.Here is an example of enabling the arbitration service for the
oracle001tenant:ALTER TENANT oracle001 ENABLE_ARBITRATION_SERVICE = true;After the command is executed successfully, query the
DBA_OB_TENANTSview again to confirm whether the arbitration service is enabled for the tenant.SELECT * FROM oceanbase.DBA_OB_TENANTS WHERE tenant_name = 'oracle001'\GThe query result is as follows.
*************************** 1. row *************************** TENANT_ID: 1004 TENANT_NAME: oracle001 TENANT_TYPE: USER CREATE_TIME: 2025-06-26 19:40:21.457857 MODIFY_TIME: 2025-06-27 13:54:29.486203 PRIMARY_ZONE: zone1;zone2 LOCALITY: FULL{1}@zone1, FULL{1}@zone2 PREVIOUS_LOCALITY: NULL COMPATIBILITY_MODE: ORACLE STATUS: NORMAL IN_RECYCLEBIN: NO LOCKED: NO TENANT_ROLE: PRIMARY SWITCHOVER_STATUS: NORMAL SWITCHOVER_EPOCH: 0 SYNC_SCN: 1687845307275557916 REPLAYABLE_SCN: 1687845307275557916 READABLE_SCN: 1687845307131393135 RECOVERY_UNTIL_SCN: 4611686018427387903 LOG_MODE: NOARCHIVELOG ARBITRATION_SERVICE_STATUS: ENABLED UNIT_NUM: 1 COMPATIBLE: 4.3.5.0 MAX_LS_ID: 1002 RESTORE_DATA_MODE: NORMAL COMMENT: 1 row in setBased on the query result, the
ARBITRATION_SERVICE_STATUScolumn isENABLED, which indicates that the arbitration service is enabled for the tenant.After the arbitration service is enabled for the tenant, the tenant may still have log streams that lack arbitration members. These log streams cannot be upgraded or downgraded normally. You can follow the steps below to confirm this.
Enabling the arbitration service for the tenant indicates that all log streams created at the time of enabling the arbitration service can use the arbitration service. However, new log streams created after the arbitration service is enabled may lack arbitration members. This is because log streams are created in non-strict mode, and the creation of arbitration members is not guaranteed. Therefore, you can use the following statement to confirm whether all log streams of the tenant have arbitration members.
The statement is as follows:
(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');The parameters are described as follows:
tenantid: the tenant ID of the tenant for which the arbitration service is enabled.arb_server_ip: the IP address of the arbitration service.arb_server_port: the RPC port of the arbitration service. The default value is 2882.
Here is an example:
(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');If the query result is empty, all log streams have arbitration members, and the arbitration service is available. If the query result is not empty, the Root Service will automatically add arbitration members to these log streams in the background. You can query the
CDB_OB_LS_ARB_REPLICA_TASKSview to confirm whether there are ongoing tasks to add arbitration members. If such tasks exist and are ongoing, you need to wait for them to complete.After the tasks to add arbitration members are completed, you can query the
CDB_OB_LS_ARB_REPLICA_TASK_HISTORYview to confirm the task results. If the tasks are successful, the log streams have arbitration members, and the arbitration service is available. If the tasks fail, contact OceanBase support for assistance.For more information about the fields of the
GV$OB_LOG_STATview, see GV$OB_LOG_STAT.
References
For more information about arbitration service, see the following topics:
