Purpose
You can use this statement to perform various operations, such as moving, copying, and deleting replicas, converting replica types, and switching the roles of replicas.
This statement can be executed only in the sys tenant.
Syntax
alter_system_replica_stmt:
ALTER SYSTEM replica_action;
replica_action:
SWITCH REPLICA {LEADER | FOLLOWER}
{ partition_id_desc SERVER [=] 'ip:port'
| SERVER [=] 'ip:port' [tenant_name]
| ZONE [=] 'zone' [tenant_name]
}
| DROP REPLICA partition_id_desc SERVER [=] 'ip:port'
[ZONE [=] 'zone'] [FORCE]
| {MOVE | COPY} REPLICA partition_id_desc
SOURCE [=] 'ip:port' DESTINATION [=] 'ip:port'
| REPORT REPLICA partition_id_desc
{ZONE [=] 'zone' | SERVER [=] 'ip:port'}
| {ALTER | CHANGE | MODIFY} REPLICA
partition_id_desc SERVER [=] 'ip:port'
[SET] REPLICA_TYPE = replica_type
partition_id_desc
PARTITION_ID [=] 'partition_id%partition_cnt@table_id'
partition_id | partition_cnt | table_id | task_id:
INT_VALUE
tenant_name_list:
tenant_name [, tenant_name ...]
tenant_name:
TENANT [=] tenant
replica_type:
{Full | F}
Parameters
| Parameter | Description | |
|---|---|---|
| SWITCH REPLICA | Reelects a leader. | |
| DROP REPLICA | Drops a replica from a specified OBServer node. You must specify the partition_id_desc parameter and the IP address of the OBServer node. |
|
| {MOVE | COPY} REPLICA | Moves or copies a replica. You must specify the source OBServer node, destination OBServer node, and partition_id_desc. |
|
| REPORT REPLICA | Force makes an OBServer node or all OBServer nodes in a zone perform replica reporting. | |
| {ALTER | CHANGE \ | MODIFY} REPLICA | Modifies replica attributes. You can modify the type of a specified replica. The supported replica type is Full, which indicates full-featured replicas. The value of replica_type can be the full name of the replica type or its initial letter F, which is case-insensitive. |
Examples
Move the replica whose partition ID is
0%0@1100611139403777fromxxx.xx.xx.xx1toxxx.xx.xx.xx2.obclient> ALTER SYSTEM MOVE REPLICA PARTITION_ID '0%0@1100611139403777' SOURCE 'xxx.xx.xx.xx1:xxxx' DESTINATION 'xxx.xx.xx.xx2:xxxx';Drop the replica whose partition ID is
0%0@1100611139403777.obclient> ALTER SYSTEM DROP REPLICA PARTITION_ID '0%0@1100611139403777' SERVER 'xxx.xx.xx.xx1:xxxx';