This topic describes how to check the configurations of the primary cluster before you add a standby cluster.
Procedure
In the primary cluster, run the following command to check whether a standby cluster can be added:
obclient > ALTER SYSTEM ADD CLUSTER VERIFY;
Notice
After tenants are physically restored in the primary cluster, a major compaction needs to be performed before you can create a standby cluster. In OceanBase Database versions earlier than V2.2.76, the ADD CLUSTER VERIFY command does check whether a standby cluster can be added. However, in OceanBase V2.2.76 or later, the command will check whether a major compaction has been performed before you create a standby cluster, and will display the NEED MAJOR FREEZE AFTER RESTORE TENANT error message if a major compaction has not been performed.
If the command succeeds, you can add a standby cluster.
If the command fails, the system returns an error message in the format of Add cluster not allowed. Actions: action. action indicates the cause and recommended solution. For more information, see the following table.
| Error message | Cause and analysis | Solution |
|---|---|---|
NEED MAJOR FREEZE AS SYS SCHEMA CHANGED |
A major compaction is not performed after the schema of the system table is changed. After the primary cluster is upgraded, the schema of the system table is changed. Therefore, a major compaction needs to be performed before you can add a standby cluster of the same version. If a major compaction has not been performed, this error will be reported. | Initiate a major compaction on the primary cluster and wait for the major compaction to complete. For more information, see Manually trigger major compaction. |
CHECK TABLE PRIMARY ZONE OR LOCALITY CONFIG |
Primary Zone or Locality is configured for a table under a tenant. You cannot add a standby cluster if Primary Zone or Locality is configured for a table under the tenant. | Clear the Primary Zone and Locality configurations for the table. |
CHECK TABLEGROUP PRIMARY ZONE OR LOCALITY CONFIG |
Primary Zone or Locality is configured for a table group. You cannot add a standby cluster if Primary Zone or Locality is configured for a table group. | Clear the Primary Zone and Locality configurations for the table group. |
CHECK DB PRIMARY ZONE CONFIG |
Primary Zone is configured for a database under a tenant. You cannot add a standby cluster if Primary Zone is configured for a database under a tenant. | Clear the Primary Zone configuration for the database. |
CHECK TENANT GTS CONFIG |
The cluster contains tenants whose time service is not set to GTS. A standby cluster supports only tenants whose time service is set to GTS. | Ensure that ob_timestamp_service is set to GTS for all common tenants. |
CHECK TENANT IN RESTORE |
Some tenants are under restoration. You cannot add a standby cluster when some tenants of the primary cluster are being physically restored. | Wait until the tenants are restored, or delete the tenants under restoration. |
NEED OFFLINE GARBAGE REPLICA |
Uncollected garbage replicas exist. Garbage replicas are left after you delete a table or a partition. To ensure proper operation of the primary cluster, you cannot add a standby cluster before the garbage replicas are collected. | Wait until all the garbage replicas are collected. |
CHECK ENABLE_ONE_PHASE_COMMIT CONFIGURATION |
ENABLE_ONE_PHASE_COMMIT is True. You cannot add a standby cluster when ENABLE_ONE_PHASE_COMMIT is True. |
Set ENABLE_ONE_PHASE_COMMIT to False. |
CHECK CLUSTER ROLE |
The cluster role is not PRIMARY. |
You can add a standby cluster only to the primary cluster. |
CHECK CLUSTER UPGRADE MODE |
The primary cluster is being upgraded. You cannot add a standby cluster to the primary cluster when the primary cluster is being upgraded. | Wait until the upgrade is completed. |
NEED WAIT MAJOR FREEZE FINISHED AFTER FAILOVER |
A major compaction after a failover is in progress. After a failover, the system internally initiates a major compaction. You cannot add a standby cluster before the major compaction is completed. | Wait until the major compaction is completed. |
REACH ALL CLUSTER COUNT LIMIT |
The number of standby clusters has reached the upper limit. The primary/standby cluster configuration of OceanBase Database supports one primary cluster and up to 31 standby clusters. You cannot add more standby clusters when the number of standby clusters reaches 31. | View the cluster status in the V$OB_STANDBY_STATUS view and delete the standby clusters that are not in use. For more information, see Delete a standby cluster. |
NEED MAJOR FREEZE AFTER RESTORE TENANT |
A major compaction has not been performed after tenants are physically restored. You cannot add a standby cluster. After tenants are physically restored in the primary cluster, a major compaction needs to be performed before you can add a standby cluster. If a major compaction has not been performed, the data of the tenants that are physically restored cannot be synchronized to the standby cluster. | Initiate a major compaction on the primary cluster and wait for the major compaction to complete. For more information, see Manually trigger major compaction. |