Modifying a zone primarily involves changing the region and IDC information to which the zone belongs.
Limitations
Currently, modifying the ZONE_TYPE of a zone is not supported.
Procedure
Log in to the
systenant of the cluster as therootuser.The following is an example connection string. Please adjust the database connection parameters according to your actual environment.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -AFor more detailed instructions on connecting to a database, see Overview of database connections (MySQL-compatible mode) and Overview of database connections (Oracle-compatible mode).
Execute the following command to modify zone attributes.
The statement is as follows:
obclient [(none)]> ALTER SYSTEM {ALTER|CHANGE|MODIFY} ZONE zone_name SET [IDC [=]'idc_name', REGION [=]'region_name'];The relevant parameters are described below:
{ALTER|CHANGE|MODIFY}indicates thatALTER,CHANGE, andMODIFYhave the same functionality. You can use any one of these keywords to modify zone attributes.zone_name: the name of the zone to be modified. Each statement only supports modifying one zone at a time.idc_name: the name of the IDC where the zone is located.region_name: the name of the region where the zone is located.
For example, to change the region of the current cluster to
shanghaiand the IDC tosh1, you can use the following example:obclient [(none)]> ALTER SYSTEM ALTER ZONE zone4 SET REGION 'shanghai',IDC 'sh1';After the operation succeeds, you can query the
oceanbase.DBA_OB_ZONESview to confirm the changes.obclient [(none)]> SELECT * FROM oceanbase.DBA_OB_ZONES; +-------+----------------------------+----------------------------+----------+-----+----------+-----------+ | ZONE | CREATE_TIME | MODIFY_TIME | STATUS | IDC | REGION | TYPE | +-------+----------------------------+----------------------------+----------+-----+----------+-----------+ | zone1 | 2022-12-20 17:50:17.168745 | 2022-12-20 17:50:40.801054 | ACTIVE | HZ0 | hangzhou | ReadWrite | | zone2 | 2022-12-20 17:50:17.168745 | 2022-12-20 17:50:40.809504 | ACTIVE | HZ0 | hangzhou | ReadWrite | | zone3 | 2022-12-20 17:50:17.169804 | 2022-12-20 17:50:40.815833 | ACTIVE | SH0 | shanghai | ReadWrite | | zone4 | 2023-01-06 15:25:07.190559 | 2023-01-06 15:25:29.281242 | INACTIVE | sh1 | shanghai | ReadWrite | +-------+----------------------------+----------------------------+----------+-----+----------+-----------+ 4 rows in setFor more details about the
oceanbase.DBA_OB_ZONESview, see oceanbase.DBA_OB_ZONES.
References
For more zone-related operations, see the following information:
