This topic describes how to check the configurations of the primary cluster before you add a standby cluster.
Procedure
In the primary cluster, execute the following statement 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 add a standby cluster. In OceanBase Database versions earlier than V2.2.76, the
ADD CLUSTER VERIFYstatement does check whether a standby cluster can be added. In OceanBase V2.2.76 and later, the statement checks whether a major compaction has been performed before you add a standby cluster, and returns theNEED MAJOR FREEZE AFTER RESTORE TENANTerror message if a major compaction has not been performed.
If the statement execution succeeds, you can add a standby cluster.
If the statement execution fails, an error message in the format of Add cluster not allowed. Actions: action is returned. action indicates the error cause and recommended solution. For more information, see the following table.
| Error message | Error cause and analysis | Troubleshooting suggestion |
|---|---|---|
NEED MAJOR FREEZE AS SYS SCHEMA CHANGED |
A major compaction is not performed after the schema of a system table is changed. After the primary cluster is upgraded, the schema of a 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 initiate a major compaction. |
CHECK TABLE PRIMARY ZONE OR LOCALITY CONFIG |
A primary zone or locality is configured for a table under a tenant. You cannot add a standby cluster if a primary zone or locality is configured for a table under the tenant. |
Execute the ALTER TABLE table name SET PRIMARY_ZONE = 'default'; statement to clear the primary zone configuration of the table or execute the ALTER TABLE table_name SET locality = 'default'; statement to clear the locality configuration of the table. |
CHECK TABLEGROUP PRIMARY ZONE OR LOCALITY CONFIG |
A primary zone or locality is configured for a table group. You cannot add a standby cluster if a primary zone or locality is configured for a table group. |
Execute the ALTER TABLEGROUP tablegroup name SET PRIMARY_ZONE = 'default'; statement to clear the primary zone configuration of the table group or execute the ALTER TABLEGROUP tablegroup_name SET locality = 'default'; statement to clear the locality configuration of the table group. |
CHECK DB PRIMARY ZONE CONFIG |
A primary zone is configured for a database under a tenant. You cannot add a standby cluster if a primary zone is configured for a database under a tenant. |
Execute the ALTER DATABASE dbname SET PRIMARY_ZONE = 'default'; statement to clear the primary zone configuration of the database. |
CHECK TENANT GTS CONFIG |
The cluster contains tenants whose time service is not set to Global Timestamp Service (GTS). A standby cluster supports only tenants whose time service is set to GTS. |
Make sure that ob_timestamp_service is set to GTS for all normal tenants. |
CHECK TENANT IN RESTORE |
Some tenants are under restore. You cannot add a standby cluster when some tenants of the primary cluster are being physically restored. |
Wait until the restore is complete, or delete the tenants under restore. For more information about how to delete a tenant, see Delete a tenant. |
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 set to True. You cannot add a standby cluster when ENABLE_ONE_PHASE_COMMIT is set to True. |
Set ENABLE_ONE_PHASE_COMMIT to False. |
CHECK CLUSTER ROLE |
The cluster role is not PRIMARY. |
Set the cluster role to 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 complete. |
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 complete. |
Wait until the major compaction is complete. For more information about how to view the major compaction progress, see View the major compaction process. |
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 standby clusters. |
Initiate a major compaction on the primary cluster and wait for the major compaction to complete. For more information, see Manually initiate a major compaction. |