Purpose
This statement is used to delete a replica of a log stream.
Limitations and considerations
Ensure that a majority of log streams still exist after deleting the replica; otherwise, the O&M command will report an error.
This statement can delete only one replica at a time.
For the same log stream of a tenant, except that multiple replica migration tasks can be executed in parallel, only one disaster recovery task (including adding replicas, deleting replicas, converting replica types, and modifying the quorum size of a log stream) can be executed at a time.
Note
You can query the
CDB_OB_LS_REPLICA_TASKSview in the sys tenant or theDBA_OB_LS_REPLICA_TASKSview in a user tenant to check whether any disaster recovery tasks are running.
Privilege requirements
The user executing this statement must have the ALTER SYSTEM privilege. For more information about OceanBase AI Database privileges, see Permission classification.
Syntax
ALTER SYSTEM REMOVE REPLICA
LS [=] ls_id
SERVER [=] 'svr_ip:svr_port'
[PAXOS_REPLICA_NUM [=] paxos_replica_num]
[TENANT [=] 'tenant_name'];
Parameters
Parameters |
Description |
|---|---|
| ls_id | Specifies the log stream ID of the replica to be deleted. |
| svr_ip:svr_port | Specify the IP address and port number of the server where the replica to be deleted is located. For example, xxx.xx.xxx.001:2882. |
| paxos_replica_num | Optional. Specifies the required number of quorum members for the log stream leader. If this value is not explicitly specified, the system will use the current default value of paxos_replica_num. At the same time, the number of F replicas for a log stream cannot exceed 7.
NoticeTo specify a value for this parameter, the following conditions must be met:
|
| tenant_name | Optional. Specifies the tenant to operate on. If not explicitly specified, the default tenant is the current tenant.
Notice
|
Examples
Execute the following command in the sys tenant to delete a log stream replica for the mysql001 tenant.
ALTER SYSTEM REMOVE REPLICA
LS = 1001
SERVER = 'xxx.xxx.xxx.001:2882'
PAXOS_REPLICA_NUM = 2
TENANT = 'mysql001';
For more examples of deleting log stream replicas, see Reduce replicas.
References
- For information about manually adding log stream replicas, see ADD REPLICA.
- For information about converting log stream replica types, see MODIFY REPLICA.
- For information about migrating log stream replicas, see MIGRATE REPLICA.
- For information about modifying the log stream
PAXOS_REPLICA_NUM, see MODIFY PAXOS_REPLICA_NUM. - For information about canceling a log stream replica task, see CANCEL REPLICA TASK.