Purpose
This statement is used to migrate a replica of a log stream to a specified location.
Limitations and considerations
Replica migration can only be performed within the same zone.
Before executing the replica migration operation, ensure that the target server has available resources (units) and that the unit does not already contain a replica of the log stream.
If the log stream already has 7 F replicas, the migration command cannot be executed.
This statement can only migrate one log stream replica at a time. To migrate multiple replicas, the statement must be executed multiple times.
For the same log stream in a tenant, multiple replica migration tasks can be executed in parallel, but other disaster recovery tasks (such as adding, removing, or changing replica types, and modifying the quorum member count) can only be executed one at a time.
Note
The sys tenant can check the
CDB_OB_LS_REPLICA_TASKSview to confirm if any disaster recovery tasks are running. User tenants can check theDBA_OB_LS_REPLICA_TASKSview for the same information.
Privilege requirements
The user executing this statement must have the ALTER SYSTEM privilege. For more information about OceanBase Database privileges, see Privilege classification in MySQL mode and Privilege classification in Oracle mode.
Syntax
ALTER SYSTEM MIGRATE REPLICA
LS [=] ls_id
SOURCE [=] 'svr_ip:svr_port'
DESTINATION [=] 'destination_addr'
[DATA_SOURCE [=] 'data_source']
[TENANT [=] 'tenant_name'];
Parameters
| Parameter | Description |
|---|---|
| ls_id | Specifies the ID of the log stream whose replica is to be migrated. |
| svr_ip:svr_port | Specifies the IP address and port of the server where the replica to be migrated is located. For example, xxx.xx.xxx.001:2882. |
| destination_addr | Specifies the IP address and port of the target server for the replica migration. The format is svr_ip:svr_port, for example, xxx.xx.xxx.002:2882. |
| data_source | Optional. Specifies the data source address for the replica. You can select any replica of the log stream as the data source. Choose based on your business needs. The format is svr_ip:svr_port, for example, xxx.xx.xxx.001:2882. If this parameter is not specified, the system will automatically select an available data source.
NoticeIf the specified data source is unavailable, an error will be reported. |
| tenant_name | Optional. Specifies the tenant to operate on. If not specified, the current tenant is used by default.
NoticeThe sys tenant can specify other tenants, while user tenants can only specify their own tenant. This statement does not support using |
Examples
Execute the following command in the sys tenant to migrate a replica of log stream 1002 from xxx.xxx.xxx.001:2882 to xxx.xxx.xxx.002:2882 in the mysql001 tenant.
ALTER SYSTEM MIGRATE REPLICA
LS = 1002
SOURCE = 'xxx.xxx.xxx.001:2882'
DESTINATION = 'xxx.xxx.xxx.002:2882'
TENANT = 'mysql001';
For more examples of migrating log stream replicas, see Replica migration.
References
- For information about manually adding a log stream replica, see ADD REPLICA.
- For information about removing a log stream replica, see REMOVE REPLICA.
- For information about changing the type of a log stream replica, see MODIFY REPLICA.
- For information about modifying the
PAXOS_REPLICA_NUMof a log stream, see MODIFY PAXOS_REPLICA_NUM. - For information about canceling a log stream replica task, see CANCEL REPLICA TASK.
