Purpose
You can use this statement to migrate a replica of a log stream.
Limitations and considerations
You can migrate replicas only within the same zone.
The destination OBServer node must have an available unit that does not contain replicas of the log stream.
If the current log stream already has seven full-featured replicas, you cannot execute the migration statement.
This statement migrates only one replica at a time. To migrate multiple replicas, you must execute this statement multiple times.
For the same log stream of a tenant, except for replica migration tasks that can be executed in parallel, other disaster recovery tasks (including adding replicas, deleting replicas, converting replica types, and modifying the quorum size of the log stream) can only be executed one at a time.
Note
You can query ongoing replica tasks from the
CDB_OB_LS_REPLICA_TASKSview in the `sys` tenant or from theDBA_OB_LS_REPLICA_TASKSview in a user tenant.
Required privileges
To execute this statement, you must have the ALTER SYSTEM privilege. For more information about privileges in OceanBase Database, see Privilege types in MySQL mode and Privilege types 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 | The ID of the log stream for which you want to migrate the replica. |
| svr_ip:svr_port | The IP address and port number of the OBServer node from which you want to migrate the replica, for example, xxx.xx.xxx.001:2882. |
| destination_addr | The IP address and port number of the OBServer node to which you want to migrate the replica. The format is svr_ip:svr_port, for example, xxx.xx.xxx.002:2882. |
| data_source | Optional. The data source of the replica that you want to migrate. You can select any other replica of the log stream as the data source based on your business needs. The format is svr_ip:svr_port, for example, xxx.xx.xxx.001:2882. If this parameter is not explicitly specified, the system automatically selects an available data source.
NoticeIf the specified data source is unavailable, the system will return an error. |
| tenant_name | Optional. The name of the target tenant. If this parameter is not specified, the name of the current tenant is used.
NoticeYou can specify another tenant in the |
Examples
Execute the following statement in the sys tenant to migrate the log stream replica with the ID of 1002 on xxx.xxx.xxx.001:2882 in the mysql001 tenant to xxx.xxx.xxx.002:2882.
ALTER SYSTEM MIGRATE REPLICA
LS = 1002
SOURCE = 'xxx.xxx.xxx.001:2882'
DESTINATION = 'xxx.xxx.xxx.002:2882'
TENANT = 'mysql001';
For more information about how to migrate a replica, see Migrate replicas.
References
- For information about how to add a replica, see ADD REPLICA.
- For information about how to drop a replica, see REMOVE REPLICA.
- For information about how to modify the type of a replica, see MODIFY REPLICA.
- For information about how to modify the
PAXOS_REPLICA_NUMparameter for a replica, see MODIFY PAXOS_REPLICA_NUM. - For information about how to cancel a replica task, see CANCEL REPLICA TASK.