Purpose
You can use this statement to manage clusters, such as adding, verifying, deleting, and changing cluster attributes and disconnecting a standby cluster.
Note
This statement can be executed only under the sys tenant in the primary cluster.
Syntax
ALTER SYSTEM cluster_action
cluster_action:
ADD CLUSTER cluster_name CLUSTER_ID [=] cluster_id
| ADD CLUSTER VERIFY
| REMOVE CLUSTER cluster_name CLUSTER_ID [=] cluster_id [FORCE]
| ENABLE CLUSTER SYNCHRONIZATION cluster_name CLUSTER_ID [=] cluster_id
| DISABLE CLUSTER SYNCHRONIZATION cluster_name CLUSTER_ID [=] cluster_id
| MODIFY CLUSTER SYNCHRONIZATION cluster_name CLUSTER_ID [=] cluster_id
SET REDO_TRANSPORT_OPTIONS = '[NET_TIMEOUT=timeout] [SYNC|ASYNC]'
| DISCONNECT STANDBY CLUSTER standby_cluster_name CLUSTER_ID standby_cluster_id
SET CLUSTER_NAME standby_new_cluster_name [OBCONFIG_URL 'config_url'];
Parameters
| Parameter | Description |
|---|---|
| ADD CLUSTER | Adds a standby cluster. If the configuration of the primary cluster does not meet the conditions, the addition fails. We recommend that you execute the ADD CLUSTER VERIFY statement to check whether a standby cluster can be added to the primary cluster before adding the standby cluster. |
| ADD CLUSTER VERIFY | Verifies whether a standby cluster can be added. If the statement is executed successfully, the standby cluster can be added. If the execution fails, the reason is returned. If the statement fails, the returned message is in the format of Add cluster not allowed. Actions:action. action indicates the reason and the recommended solution. For details about returned messages and suggested solutions of action, see "Check the configurations of the primary cluster" in the OceanBase Database Administrator Guide. |
| REMOVE CLUSTER | Deletes an existing standby cluster. The target cluster to be deleted does not necessarily play a standby role. During a failover, there are two primary clusters: the new primary cluster and the original primary cluster. You can retain one of the primary clusters as the target primary cluster and delete the other one. Notice
|
| ENABLE CLUSTER SYNCHRONIZATION | Enables data synchronization for a standby cluster. After you enable data synchronization for a standby cluster, the system verifies whether the standby cluster can continue to synchronize data. During a failover, data synchronization cannot be enabled when data is inconsistent between the primary cluster and the standby cluster. |
| DISABLE CLUSTER SYNCHRONIZATION | Disables data synchronization for a standby cluster. |
| MODIFY CLUSTER SYNCHRONIZATION | Modifies the log synchronization mode of a standby cluster and the timeout duration for the primary cluster to wait for a response from a standby cluster in SYNC mode when the maximum availability mode is adopted in the primary cluster. The default synchronization mode is ASYNC. |
| SYNC | The synchronous mode. In this mode, the REDO logs of the primary cluster are synchronously transferred to the destination standby cluster, which means that the persistent storage of a REDO log is considered successful only after the log is persistently stored in both the primary cluster and the standby cluster. In maximum protection or maximum availability mode, you can set only one standby cluster to be in SYNC mode for the primary cluster. In maximum performance mode, this transfer mode does not take effect, and ASYNC mode is adopted. You can set the primary cluster to be in SYNC mode, but this setting takes effect only when the cluster becomes a standby cluster after switchover. Specifically, in maximum protection and maximum availability modes, the primary cluster must be set to be in SYNC mode before switchover, so that at least one standby cluster is in SYNC mode after the switchover. |
| ASYNC | The asynchronous mode. In this mode, the REDO logs of the primary cluster are asynchronously transferred to the target standby cluster. The transaction committing latency is not affected by the destination standby cluster. |
| NET_TIMEOUT | The timeout duration, in microseconds, for the primary cluster to wait for a response from a standby cluster in SYNC mode when the maximum availability mode is adopted. If no response is received after the timeout duration is elapsed, the primary cluster is automatically downgraded to the ASYNC mode. This parameter is meaningless in other protection modes. |
| DISCONNECT STANDBY CLUSTER | Selects a standby cluster to disconnect it from the primary cluster. |
| standby_cluster_name | The name of the standby cluster to be disconnected. You can obtain the name from the V$OB_CLUSTER view. |
| standby_cluster_id | The ID of the standby cluster to be disconnected. You can obtain the ID from the V$OB_CLUSTER view. |
| standby_new_cluster_name | The new name for the standby cluster to be disconnected. |
| OBCONFIG_URL 'config_url' | The new OBCONFIG_URL for the standby cluster to be disconnected. OBCONFIG_URL specifies the URL of the OBConfig server. This parameter is optional. |
Examples
Verify whether a standby cluster can be added.
obclient> ALTER SYSTEM ADD CLUSTER VERIFY;Add the standby cluster
ob1.test.obclient> ALTER SYSTEM ADD CLUSTER 'ob1.test' CLUSTER_ID = 1;Enable data synchronization for the standby cluster
ob1.test.obclient> ALTER SYSTEM ENABLE CLUSTER SYNCHRONIZATION 'ob1.test' CLUSTER_ID = 1;Set the log transfer mode for the standby cluster
ob1.testto be in SYNC mode andNET_TIMEOUTto 30 seconds.obclient> ALTER SYSTEM MODIFY CLUSTER 'ob1.test' CLUSTER_ID = 1 SET REDO_TRANSPORT_OPTIONS = 'SYNC NET_TIMEOUT=30000000';
Disconnect a standby cluster.
obclient> ALTER SYSTEM DISCONNECT STANDBY CLUSTER test322 CLUSTER_ID 100027 SET CLUSTER_NAME test325 OBCONFIG_URL 'http://ocp-cfg.alibaba.net:8080/services?User_ID=alibaba&UID=test&Action=ObRootServiceInfo&ObRegion=config_url_demo_cluster';