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. 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. For more information about how to deploy the arbitration service, see Deploy an OceanBase cluster with two replicas and the arbitration service.
The target tenant has two or four full-featured replicas.
Note
If you want to enable the arbitration service for a tenant, the number of full-featured replicas in the locality of the tenant must meet the specified requirement. The number of read-only replicas in the locality of the tenant is not limited. For example, if the locality of a tenant is
F@z1,F@z2orF@z1,F@z2,R@z3, you can enable the arbitration service for the tenant.
Procedure
Log on to the
systenant of the cluster as therootuser.Note that you must specify the corresponding parameters in the following sample code based on your actual database configurations.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -AFor more information about how to connect to a database, see Overview (MySQL mode) or Overview (Oracle mode).
Execute the following statement to query the connection status of all nodes 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 setThe connection status between a node and the arbitration service is indicated by the value of the
STATUSfield in the query result.ACTIVE: The arbitration service can communicate with the node. You can enable the arbitration service for the tenant only when the arbitration service can communicate with all nodes.INACTIVE: The arbitration service cannot communicate with the node. In this case, you cannot enable the arbitration service for the tenant. Check the network communication between the node and the arbitration service.
Query the status of the arbitration service 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: 2023-06-26 19:40:21.457857 MODIFY_TIME: 2023-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.2.0.0 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:
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:ALTER TENANT oracle001 ENABLE_ARBITRATION_SERVICE = true;Query the
DBA_OB_TENANTSview to check 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: 2023-06-26 19:40:21.457857 MODIFY_TIME: 2023-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.2.0.0 1 row in setIn the query result, 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, some log streams of the tenant may still have no arbitration members. These log streams cannot be downgraded or upgraded. Check whether all log streams have arbitration members.
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 check whether all log streams of the tenant have arbitration members:
Here is a sample statement:
(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 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.
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. Otherwise, RootService 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_TASKSview.After the task is completed, you can query the
CDB_OB_LS_ARB_REPLICA_TASK_HISTORYview 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.For more information about columns in the
GV$OB_LOG_STATview, see GV$OB_LOG_STAT.
References
For more information about the arbitration service, see the following topics: