OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database

SQL - V4.2.1

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogWhite PaperLive DemosTraining & CertificationTicket
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.2.1
    iconOceanBase Database
    SQL - V 4.2.1
    Databases
    • OceanBase Database
    • OceanBase Cloud
    • OceanBase Tugraph
    • Interactive Tutorials
    • OceanBase Best Practices
    Tools
    • OceanBase Cloud Platform
    • OceanBase Migration Service
    • OceanBase Developer Center
    • OceanBase Migration Assessment
    • OceanBase Admin Tool
    • OceanBase Loader and Dumper
    • OceanBase Deployer
    • Kubernetes operator for OceanBase
    • OceanBase Diagnostic Tool
    • OceanBase Binlog Service
    Connectors and Middleware
    • OceanBase Database Proxy
    • Embedded SQL in C for OceanBase
    • OceanBase Call Interface
    • OceanBase Connector/C
    • OceanBase Connector/J
    • OceanBase Connector/ODBC
    • OceanBase Connector/NET
    SQL
    KV
    • V 4.6.0
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    Online upgrade from standalone deployment to distributed deployment

    Last Updated:2026-04-28 09:23:26  Updated
    Share
    What is on this page
    Prerequisites
    Procedure
    Step 1: Deploy OBServer nodes
    Step 2: Scale out the cluster
    Step 3: Add replicas to the tenant
    References

    folded

    Share

    OceanBase Database is built based on an integrated architecture for centralized and distributed modes and supports the online upgrade from standalone deployment to distributed deployment.

    This topic describes how to upgrade to three-replica deployment online by using an RPM package.

    Note

    You can also add OBServer nodes to zones to switch from the standalone deployment mode to the distributed deployment mode, which is the single-replica multi-node deployment mode. For more information, see Add a node.

    Prerequisites

    • The servers have been configured. For more information, see Configure servers.

    • The servers have been initialized. For more information about how to initialize a server, see Initialize an OBServer node by using oatcli.

    • You have obtained the RPM package of OceanBase Database.

      Note

      To download the required package, go to OceanBase Download Center and then find the installation package of the required version. If no installation package is available, contact OceanBase Technical Support.

    Procedure

    Step 1: Deploy OBServer nodes

    Perform the following steps on two servers.

    1. Install the RPM package of OceanBase Database.

      Here is an example:

      [root@xxx /home/admin/rpm]# rpm -ivh oceanbase-4.1.0.0-100000682023020119.el7.x86_64.rpm
      Preparing...                          ################################# [100%]
      Updating / installing...
         1:oceanbase-4.1.0.0-100000682023020################################# [100%]
      
    2. (Optional) Clear the directory.

      You do not need to clear the directory if you deploy OceanBase Database on the server for the first time.

      You can directly clear the old OceanBase Database directory in the following cases:

      • You want to clear the old OceanBase Database environment.
      • Problems occur during the installation and deployment process of OceanBase Database. The installation environment becomes disordered or files that will affect the next installation are generated.

      Here is an example:

      [root@xxx /home/admin]# rm -rf /data/1/obdemo
      [root@xxx /home/admin]# rm -rf /data/log1/obdemo
      [root@xxx /home/admin]# rm -rf /home/admin/oceanbase/store/obdemo
      [root@xxx /home/admin]# rm -rf /home/admin/oceanbase/log/* /home/admin/oceanbase/etc/*config*
      
    3. Initialize the OceanBase Database directory.

      We recommend that you specify the data directory of OceanBase Database to an independent disk and link this directory to the home directory of OceanBase Database by using a soft link.

      Here is an example:

      [root@xxx /home/admin]# su - admin
      -bash-4.2$ mkdir -p /data/1/obdemo/{etc3,sort_dir,sstable,slog}
      -bash-4.2$ mkdir -p /data/log1/obdemo/{clog,etc2,ilog,oob_clog}
      -bash-4.2$ mkdir -p /home/admin/oceanbase/store/obdemo
      -bash-4.2$ for t in {etc3,sort_dir,sstable,slog};do ln -s /data/1/obdemo/$t /home/admin/oceanbase/store/obdemo/$t; done
      -bash-4.2$ for t in {clog,etc2,ilog,oob_clog};do ln -s /data/log1/obdemo/$t /home/admin/oceanbase/store/obdemo/$t; done
      

      Note

      The obdemo directory is named after the cluster and can be modified. It is required when the process starts.

    4. Start the observer process.

      You must start the observer process as the admin user. Here is an example:

      /home/admin/oceanbase/bin/observer {-I $ip | -i $devname} -P $rpc_port -p $sql_port -z $zone_name -d /home/admin/oceanbase/store/$cluster_name -r '$ip:2882:2881' -c $cluster_id -n $cluster_name -o "system_memory=30G,datafile_size=100G,config_additional_dir=/data/1/$cluster_name/etc3;/data/log1/$cluster_name/etc2"
      

      Options in the command above are described as follows:

      Option
      Description
      -I | -i
      • -I: the IP address of the node to be started. If OceanBase Database is deployed in distributed mode, you cannot specify 127.0.0.1 for this option. We recommend that you specify another IP address such as -I 10.10.10.1.
      • -i: the NIC name. You can use the ifconfig command to view the NIC name.

      Note

      You can specify both the IP address and the NIC name to start a node, such as -I 10.10.10.1 -i eth0. However, this is not recommended.

      -p The service port number, which is usually set to 2881.
      -P The RPC port number, which is usually set to 2882.
      -n The name of the cluster. It can be modified. Cluster names must be unique.
      -z The zone where the started observer process belongs.
      -d The primary directory of the cluster, which is created during initialization. Do not modify other parts of the directory except $cluster_name.
      -c The cluster ID. It is a group of digits and can be modified. Cluster IDs must be unique.
      -l The log level.
      -r The RootService list in the $ip:2882:2881 format. Separate multiple items with semicolons (;).
      -o The cluster startup parameters that need to be specified as needed.
      • system_memory specifies the internal reserved memory of OceanBase Database, which is 30G by default. You can adjust this parameter to a smaller value in the case of insufficient memory on the server. The impact is that memory may be insufficient during performance tests.
      • datafile_size specifies the size of the SSTable data file of OceanBase Database, which is determined based on the available space of /data/1/. You no longer need to specify the size again once specified in this step. We recommend that you specify the data file size to at least 100G and reserve some spaces.

        Note

        If /data/1 and /data/log1 belong to the same file system (share the same disk), make sure that the space reserved for /data/log1 is two to four times the size of the memory.

      • config_additional_dir specifies the redundancy directory for the parameter file.

      Here is an example:

      1. Start the observer process on the server whose IP address is 10.10.10.2.

        [root@xxx /home/admin]# su - admin
        -bash-4.2$ /home/admin/oceanbase/bin/observer -I 10.10.10.2 -P 2882 -p 2881 -z zone2 -d /home/admin/oceanbase/store/obdemo -r '10.10.10.2:2882:2881' -c 10001 -n obdemo -o "system_memory=30G,datafile_size=500G,config_additional_dir=/data/1/obdemo/etc3;/data/log1/obdemo/etc2"
        
      2. Start the observer process on the server whose IP address is 10.10.10.3.

        [root@xxx /home/admin]# su - admin
        -bash-4.2$ /home/admin/oceanbase/bin/observer -I 10.10.10.3 -P 2882 -p 2881 -z zone3 -d /home/admin/oceanbase/store/obdemo -r '10.10.10.3:2882:2881' -c 10001 -n obdemo -o "system_memory=30G,datafile_size=500G,config_additional_dir=/data/1/obdemo/etc3;/data/log1/obdemo/etc2"
        
    5. Verify that the observer process is started.

      You can use the following commands to check whether the observer process has started successfully:

      • Run the netstat -ntlp command. If ports 2881 and 2882 are being listened to, the observer process is started.
      • Run the ps -ef|grep observer command to return information about the observer process.

      Here is an example:

      -bash-4.2$ netstat -ntlp
      (Not all processes could be identified, non-owned process info
      will not be shown, you would have to be root to see it all.)
      Active Internet connections (only servers)
      Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
      tcp        0      0 0.0.0.0:2881            0.0.0.0:*               LISTEN      115745/observer
      tcp        0      0 0.0.0.0:2882            0.0.0.0:*               LISTEN      115745/observer
      ...        ...    ...                       ...                     ...         ...
      
      -bash-4.2$ ps -ef|grep observer
      admin     115745      0 37 17:14 ?        00:00:37 /home/admin/oceanbase/bin/observer -I 10.10.10.3 -P 2882 -p 2881 -z zone3 -d /home/admin/oceanbase/store/obdemo -r 10.10.10.3:2882:2881 -c 10001 -n obdemo -o system_memory=30G,datafile_size=100G,config_additional_dir=/data/1/obdemo/etc3;/data/log1/obdemo/etc2
      

    Step 2: Scale out the cluster

    1. Log on to the sys tenant of the cluster as the root user.

      [root@xxx /home/admin]# obclient -h10.10.10.1 -P2881 -uroot@sys -p
      Enter password:
      Welcome to the OceanBase.  Commands end with ; or \g.
      Your OceanBase connection id is 3221490218
      Server version: OceanBase 4.1.0.0 (r100000682023020119-c760cbb1023d73a2647f28add283646b1569418f) (Built Feb  1 2023 20:07:36)
      
      Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.
      
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
      
      obclient [(none)]>
      
    2. Add zones to the cluster.

      Add two zones named zone2 and zone3. Here is an example:

      obclient [(none)]> ALTER SYSTEM ADD ZONE zone2;
      Query OK, 0 rows affected
      
      obclient [(none)]> ALTER SYSTEM ADD ZONE zone3;
      Query OK, 0 rows affected
      
    3. Start zone2 and zone3.

      Here is an example:

      obclient [(none)]> ALTER SYSTEM START ZONE zone2;
      Query OK, 0 rows affected
      
      obclient [(none)]> ALTER SYSTEM START ZONE zone3;
      Query OK, 0 rows affected
      
    4. Add OBServer nodes to the cluster.

      Add two OBServer nodes deployed in Step 1 to zone2 and zone3, respectively.

      Here is an example:

      obclient [(none)]> ALTER SYSTEM ADD SERVER '10.10.10.2:2882' ZONE 'zone2';
      Query OK, 0 rows affected
      
      obclient [(none)]> ALTER SYSTEM ADD SERVER '10.10.10.3:2882' ZONE 'zone3';
      Query OK, 0 rows affected
      
    5. Verify that the OBServer nodes are successfully added.

      Execute the following statement to verify whether the added OBServer nodes are in the list. If yes, the OBServer nodes are successfully added.

      obclient [(none)]> SELECT SVR_IP,SVR_PORT,ID,ZONE,SQL_PORT,STATUS,START_SERVICE_TIME FROM oceanbase.DBA_OB_SERVERS;
      +------------+----------+----+-------+----------+--------+----------------------------+
      | SVR_IP     | SVR_PORT | ID | ZONE  | SQL_PORT | STATUS | START_SERVICE_TIME         |
      +------------+----------+----+-------+----------+--------+----------------------------+
      | 10.10.10.3 |     2882 |  3 | zone3 |     2881 | ACTIVE | 2023-03-03 17:26:44.207835 |
      | 10.10.10.2 |     2882 |  2 | zone2 |     2881 | ACTIVE | 2023-03-03 17:25:47.772032 |
      | 10.10.10.1 |     2882 |  1 | zone1 |     2881 | ACTIVE | 2023-03-03 10:09:27.040795 |
      +------------+----------+----+-------+----------+--------+----------------------------+
      3 rows in set
      

    Step 3: Add replicas to the tenant

    1. Log on to the sys tenant of the cluster as the root user.

      [root@xxx /home/admin]# obclient -h10.10.10.1 -P2881 -uroot@sys -p
      Enter password:
      Welcome to the OceanBase.  Commands end with ; or \g.
      Your OceanBase connection id is 3221490218
      Server version: OceanBase 4.1.0.0 (r100000682023020119-c760cbb1023d73a2647f28add283646b1569418f) (Built Feb  1 2023 20:07:36)
      
      Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.
      
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
      
      obclient [(none)]>
      
    2. Modify ZONE_LIST of the resource pool.

      Add the new zones to the resource pool of the tenant. Here is an example:

      obclient [(none)]> ALTER RESOURCE POOL pool001 ZONE_LIST=('zone1','zone2','zone3');
      Query OK, 0 rows affected
      
    3. Add a replica to a tenant.

      Note

      If you add replicas to a tenant by modifying the locality, you must add them one by one.

      obclient [(none)]> ALTER TENANT tenant_oracle001 LOCALITY='F@zone1,F@zone2';
      Query OK, 0 rows affected
      
      obclient [(none)]> ALTER TENANT tenant_oracle001 LOCALITY='F@zone1,F@zone2,F@zone3';
      Query OK, 0 rows affected
      

    References

    • Connect to an OceanBase Database tenant by using OBClient
    • ALTER SYSTEM ... ZONE
    • ALTER SYSTEM ... SERVER
    • ALTER RESOURCE POOL
    • ALTER TENANT

    Previous topic

    Modify cluster parameters
    Last

    Next topic

    Overview
    Next
    What is on this page
    Prerequisites
    Procedure
    Step 1: Deploy OBServer nodes
    Step 2: Scale out the cluster
    Step 3: Add replicas to the tenant
    References