You can modify the region and IDC of a zone.
Limitations
Currently, you cannot modify the type of a zone.
Procedure
Log on to the
systenant of an OceanBase cluster as therootuser.Note that you must specify the corresponding fields in the following sample code based on your actual database configurations.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -AFor more information about how to connect to a database, see Connection methods (MySQL mode) or Connection methods (Oracle mode).
Execute the following statement to modify the attributes of a zone:
obclient [(none)]> ALTER SYSTEM {ALTER|CHANGE|MODIFY} ZONE zone_name SET [IDC [=]'idc_name', REGION [=]'region_name'];where
{ALTER|CHANGE|MODIFY}indicates that the features of theALTER,CHANGE, andMODIFYkeywords are the same. You can use any keyword to modify the attributes of the zone.zone_namespecifies the name of the zone whose attributes are to be modified. This statement modifies only one zone at a time.idc_namespecifies the name of the IDC where the zone is located.region_namespecifies the name of the region where the zone is located.
For example, to modify the region of the current cluster to
Shanghaiand the IDC tosh1, execute the following statement:obclient [(none)]> ALTER SYSTEM ALTER ZONE zone4 SET REGION 'shanghai',IDC 'sh1';After the statement is executed, you can query the
oceanbase.DBA_OB_ZONESview to verify whether the zone is modified.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 information about the
oceanbase.DBA_OB_ZONESview, see oceanbase.DBA_OB_ZONES.
References
For more zone-related O&M operations, see the following topics: