Description
The bootstrap statement is used to bootstrap an OceanBase cluster.
You only need to run the statement when you start OceanBase Database for the first time. You can only bootstrap a cluster once. If the statement execution fails, you must rebuild the OceanBase cluster.
Before you run the statement, make sure that the specified OBServer nodes are up and running.
Syntax
alter_system_bootstrap_stmt_primary:
ALTER SYSTEM BOOTSTRAP [CLUSTER PRIMARY] region_zone_server_list;
alter_system_bootstrap_stmt_standby:
ALTER SYSTEM BOOTSTRAP CLUSTER STANDBY region_zone_server_list primary_cluster_id primary_rootservice_list;
region_zone_server_list:
region_zone_server [, region_zone_server ...]
primary_cluster_id:
PRIMARY_CLUSTER_ID [=] cluster_id
primary_rootservice_list:
PRIMARY_ROOTSERVICE_LIST server_list;
region_zone_server:
[region] zone server
region:
REGION [=] region_name
zone:
ZONE [=] zone_name
server:
SERVER [=] ip_port
ip_port:
'STR_VALUE:INT_VALUE'
Parameter explanation
Parameter |
Description |
|---|---|
| PRIMARY | STANDBY | Specifies the primary or standby cluster. If you specify this parameter, you must specify the primary/standby cluster in the startup configuration of the system. If you do not specify this parameter, the primary cluster is used by default. |
| primary_cluster_id | The ID of the primary cluster, which is required when you bootstrap a standby cluster. |
| primary_rootservice_list | The list of RootServices in the primary cluster, which is required when you bootstrap a standby cluster. |
| region | The region where the RootService is located. This parameter is specified when you deploy multiple regions across multiple IDCs. |
| zone | The zone to which the RootService belongs. |
| ip | The IP address of the RootService. |
| port | The RPC port of the RootService. |
Examples
Bootstrap the system by specifying the list of RootService machines.
obclient> ALTER SYSTEM BOOTSTRAP ZONE 'xxxx1' SERVER 'xxx.xxx.xx.xx1:xxxx';If the list of RootService machines includes multiple OBServer nodes, separate them with commas (,).
obclient> ALTER SYSTEM BOOTSTRAP ZONE 'xxxx1' SERVER 'xxx.xxx.xx.xx1:xxxx', ZONE 'xxxx2' SERVER 'xxx.xxx.xx.xx2:xxxx', ZONE 'xxxx3' SERVER 'xxx.xxx.xx.xx3:xxxx';Notice
Do not break the preceding SQL statement into multiple statements.
Bootstrap a standby cluster.
obclient> ALTER SYSTEM BOOTSTRAP CLUSTER STANDBY ZONE 'xxxx1' SERVER 'xxx.xxx.xx.xx4:2882' PRIMARY_CLUSTER_ID 1 PRIMARY_ROOTSERVICE_LIST 'xxx.xxx.xx.xx1:2882';
