OceanBase logo

OceanBase

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

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

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

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.0.0Enterprise Edition

  • Overview
    • Overview
    • System architecture
    • Compatibility with MySQL
    • Compatibility with Oracle
      • Overview
      • SQL data types
      • Built-in functions
      • System views
    • Limits
  • Get Started
    • Quick start with OceanBase Database
    • Hands on for OceanBase SQL
      • Usage notes
      • Basic SQL operations (MySQL mode)
      • Basic SQL operations (Oracle mode)
    • Build applications (MySQL Mode)
      • Connect Python applications to OceanBase Database
      • Connect Java applications to OceanBase Database
      • Connect C applications to OceanBase Database
    • Build applications(Oracle Mode)
      • Connect Python applications to OceanBase Database
      • Connect Java applications to OceanBase Database
      • Connect C applications to OceanBase Database
    • Experience OceanBase advanced features
      • Experience scalable OLTP
        • Run the TPC-C benchmark in OceanBase Database
        • Experience the hot row update capability of OceanBase Database
      • Experience operational OLAP
      • Experience parallel import and data compression
      • Experience the multitenancy feature
  • Develop
    • Develop (MySQL Mode)
      • Connect to Oceanbase Database with client
        • Overview
        • Connect to an OceanBase Database tenant by using a MySQL client
        • Connect to an OceanBase Database tenant by using OBClient
        • Connect to OceanBase Database by using ODC
        • Java application
          • OceanBase Connector/J
          • Java APIs
          • Connect Java applications to OceanBase Database
        • C application
          • OceanBase Connector/C
          • C API functions
          • Connect C applications to OceanBase Database
        • Python applications
        • SpringBoot connection example
        • SpringBatch connection example
        • Example of Database connection pool configuration
          • Overview of database connection pool configuration
          • Example of configuring a Tomcat connection pool
          • Example of configuring a C3P0 connection pool
          • Example of configuring a Proxool connection pool
          • Example of configuring a HiKariCP connection pool
          • Example of configuring a DBCP connection pool
          • CommonPool configuration example
          • Example of configuring a JDBC connection pool
        • SpringJDBC connection example
        • SpringJPA connection example
        • Hibernate connection example
        • MyBatis connection example
      • Create and manage database objects
        • About DDL statements
        • View the currently connected database
        • Change the password of a user
        • Data type
          • General data types
          • Unsupported data types
        • Create and manage tables
          • About tables
          • Create a table
          • About auto-increment columns
          • About types of column constraints
          • About table structure modification
          • About table clearing
          • About table dropping
          • Flash back a dropped table
          • About table privileges
        • Create and manage partition tables
          • About partitioned tables
          • Create a partitioned table
          • Manage a partitioned table
          • Create a subpartitioned table
          • Manage a subpartitioned table
          • Partition routing
          • Indexes on partitioned tables
          • Suggestions on using partitioned tables
        • Create and manage indexes
          • About indexes
          • Create an index
          • Drop an index
        • Create and manage views
          • About views
          • Create a view
          • Modify a view
          • Delete a view
        • Create and manage sequences
          • About sequences
          • Create a sequence
          • Modify a sequence
          • Delete a sequence
        • Create and manage triggers
          • About triggers
          • Create a trigger
          • Delete a trigger
      • Query
        • About queries
        • Single-table queries
        • Conditional queries
        • ORDER BY queries
        • GROUP BY queries
        • Use the LIMIT clause in queries
        • Query data from multiple tables
          • About multi-table join queries
          • INNER JOIN queries
          • OUTER JOIN queries
          • Subqueries
        • Use operators and functions in a query
          • Use arithmetic operators in queries
          • Use numerical functions in queries
          • Use string connectors in queries
          • Use string functions in queries
          • Use datetime functions in queries
          • Use type conversion functions in queries
          • Use aggregate functions in queries
          • Use NULL-related functions in queries
          • Use the CASE conditional operator in queries
          • Use the SELECT FOR UPDATE statement to lock query results
        • Execution plan
          • View an execution plan
          • Understand an execution plan
        • Use SQL hints in queries
        • Variables of query timeout
      • DML statements and transactions
        • DML statement
          • About DML statements
          • About the INSERT statement
          • UPDATE statements
          • About the DELETE statement
          • About the REPLACE INTO statement
        • Transactions
          • About transaction control statements
          • Start a transaction
          • Transaction savepoints
          • Commit a transaction
          • Roll back a transaction
          • About transaction timeout
      • Common errors and solutions
        • About error codes
        • Database connection error
        • About timeout
          • Idle session timeout
          • Transaction timeout errors
        • About user
          • Locked user
          • Incorrect user password
        • About table
          • Table already exists
          • Table does not exist
          • Invalid use of NULL value
        • About constraint
          • Unique key conflict
          • Foreign key conflict
        • About SQL commands
          • Data truncation
    • Develop (Oracle Mode)
      • Connect to Oceanbase Database with client
        • Overview
        • Connect to an OceanBase tenant by using an Oracle client
        • Connect to an OceanBase Database tenant by using OBClient
        • Connect to OceanBase Database by using ODC
      • Application development
        • Java application
          • OceanBase Connector/J
          • Java APIs
          • Connect Java applications to OceanBase Database
        • Python application
          • OceanBase Connector/J in Python
          • Python APIs
          • Connect Python applications to OceanBase Database
        • 300.c-application-1
          • OceanBase Connector/C
          • OBCI APIs
          • Connect C applications to OceanBase Database
      • Create and manage database objects
        • About DDL statements
        • View the currently connected database
        • Change the password of a user
        • Data type
          • General data types
          • Unsupported data types
        • Create and manage tables
          • About tables
          • Create a table
          • Define an auto-increment column by using the SEQUENCE keyword
          • About types of column constraints
          • About table structure modification
          • About table clearing
          • About table dropping
          • Flash back a dropped table
          • About table privileges
        • Create and manage partition tables
          • About partitioned tables
          • Create a partitioned table
          • Manage a partitioned table
          • Create a subpartitioned table
          • Manage a subpartitioned table
          • Partition routing
          • Indexes on partitioned tables
          • Suggestions on using partitioned tables
        • Create and manage indexes
          • Drop an index
          • About indexes
          • Create an index
        • Create and manage views
          • About views
          • Create a view
          • Modify a view
          • Drop a view
        • Create and manage sequences
          • About sequences
          • Create a sequence
          • Modify a sequence
          • Delete a sequence
        • Create and manage synonyms
          • About synonyms
          • Create a synonym
          • Delete a synonym
        • Create and manage triggers
          • About triggers
          • Create a trigger
          • Modify a trigger
          • Delete a trigger
          • Enable or disable a trigger
      • Query
        • About queries
        • Single-table queries
        • Conditional queries
        • ORDER BY queries
        • GROUP BY queries
        • Use Row_Limiting_Clause in queries
        • Query data from multiple tables
          • About multi-table join queries
          • INNER JOIN queries
          • OUTER JOIN queries
          • Subqueries
        • Use operators and functions in a query
          • Use arithmetic operators in queries
          • Use numerical functions in queries
          • Use string concatenation operators in queries
          • Use string functions in queries
          • Use datetime functions in queries
          • Use type conversion functions in queries
          • Use aggregate functions in queries
          • Use NULL-related functions in queries
          • Use CASE functions in queries
          • Use the SELECT FOR UPDATE statement to lock query results
        • Execution plan
          • View execution plans of queries
          • Understand an execution plan
        • Use SQL hints in queries
        • About query timeout variables
      • DML statements and transactions
        • DML statement
          • About DML statements
          • About the INSERT statement
          • UPDATE statements
          • About the MERGE statement
          • About the DELETE statement
        • Transactions
          • About transaction control statements
          • Start a transaction
          • Transaction savepoints
          • Commit a transaction
          • Roll back a transaction
          • About transaction timeout
      • Common errors and solutions
        • Overview
        • Database connection error
        • About timeout
          • Idle session timeout
          • Transaction timeout errors
        • About user
          • Locked user
          • Incorrect user password
        • About object
          • Object already exists
          • Object does not exist
        • About constraint
          • Unique key conflict
          • Foreign key conflict
        • About sql
          • Data type inconsistency
  • Deploy
    • Overview
    • Deployment procedure
    • Preparations before deployment
      • Prepare servers
      • Configure servers
      • Prepare installation packages
    • HA solution for OceanBase clusters
    • Deploy through the CLI
      • Configure the deployment environment
        • Install oat-cli
        • Use oat-cli to configure the deployment environment
        • Configure the clock source
        • Upload installation packages
        • Configure host information
        • Check the environment before deployment
      • Deploy OCP
        • Deployment description
        • Generate a configuration file
        • Start deployment
        • Check after deployment
      • Deploy the OceanBase cluster
        • Deploy a single-replica OceanBase cluster
        • Deploy a three-replica OceanBase cluster
      • Deploy OBProxy
        • Deploy OBProxy through the CLI
      • Create an OceanBase tenant
        • View resources available for a business tenant
        • Create a tenant
        • Verify after deployment
      • Deploy OMS
        • Deployment description
        • Modify the configuration file
        • Start deployment
        • Check after deployment
      • Deploy ODC
        • Deployment description
        • Modify the configuration file
        • Start deployment
        • Check after deployment
  • Migrate
    • Overview
    • Migrate data by using SQL scripts
    • Migrate data by using MySQLDump
    • Migrate data by using DataX
    • Migrate data by using OUTFILE statements

Download PDF

Overview System architecture Compatibility with MySQL Overview SQL data types Built-in functions System views Limits Quick start with OceanBase Database Usage notes Basic SQL operations (MySQL mode) Basic SQL operations (Oracle mode) Connect Python applications to OceanBase Database Connect Java applications to OceanBase Database Connect C applications to OceanBase Database Connect Python applications to OceanBase Database Connect Java applications to OceanBase Database Connect C applications to OceanBase Database Experience operational OLAP Experience parallel import and data compression Experience the multitenancy feature Overview Deployment procedure Prepare servers Configure servers Prepare installation packages HA solution for OceanBase clustersOverview Migrate data by using SQL scripts Migrate data by using MySQLDumpMigrate data by using DataX Migrate data by using OUTFILE statements
OceanBase logo

The Unified Distributed Database for the AI Era.

Follow Us
Products
OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
Resources
DocsBlogLive DemosTraining & Certification
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.0.0
iconOceanBase Database
SQL - V 4.0.0Enterprise Edition
SQL
KV
  • 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

Deploy a three-replica OceanBase cluster

Last Updated:2023-07-24 09:52:12  Updated
share
What is on this page
Prerequisites
Procedure
Prepare the directory and install the software
Initialize the OceanBase cluster
Initialize cluster parameters (Optional)

folded

share

A three-replica OceanBase cluster requires at least three hosts respectively located in three zones. OceanBase Database is a piece of single-process software. You only need to install the oceanbase-xxx.rpm and obproxy-xxx.rpm packages. This topic describes how to install a three-replica OceanBase cluster through RPM packages.

Prerequisites

Before you install OceanBase Database, make sure that the following prerequisites are satisfied:

  • The OBServers have been configured. For more information, see Configure servers in Preparations before deployment.

  • The deployment environment has been configured. For more information, see Configure the deployment environment in Deploy through the CLI.

Procedure

Prepare the directory and install the software

  1. Install the RPM package for OceanBase Database.

    Install the RPM packages of OceanBase Database on the three hosts. $rpm_dir specifies the directory that stores the RPM package. $rpm_name specifies the name of the RPM package.

    [root@xxx /]# cd $rpm_dir
    [root@xxx $rpm_dir]# rpm -ivh $rpm_name
    

    Note

    The OceanBase Database software will be installed under the /home/admin/oceanbase directory.

  2. Clear the old OceanBase Database directory (not required at the first deployment).

    If you want to clear the old OceanBase Database environment, or problems occur during the installation and deployment process of Oceanbase Database and thereby cause an environmental disorder or generate files that will affect the next installation, you can directly clear the old OceanBase Database directory. Perform the operation on each OBServer.

    $cluster_name specifies the cluster name.

    [root@xxx admin]# su - admin
    -bash-4.2$ kill -9 `pidof observer`
    -bash-4.2$ rm -rf /data/1/$cluster_name
    -bash-4.2$ rm -rf /data/log1/$cluster_name
    -bash-4.2$ rm -rf /home/admin/oceanbase/store/$cluster_name /home/admin/oceanbase/log/* /home/admin/oceanbase/etc/*config*
    -bash-4.2$ ps -ef|grep observer
    

    Example:

    [root@hostname admin]# su - admin
    -bash-4.2$ kill -9 `pidof observer`
    -bash-4.2$ rm -rf /data/1/obdemo
    -bash-4.2$ rm -rf /data/log1/obdemo
    -bash-4.2$ rm -rf /home/admin/oceanbase/store/obdemo /home/admin/oceanbase/log/* /home/admin/oceanbase/etc/*config*
    -bash-4.2$ ps -ef|grep observer
    
  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. Perform the operation on each OBServer.

    $cluster_name specifies the cluster name.

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

    Example:

    [root@xxx 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.

    The following sample code shows how to verify the result:

    -bash-4.2$ cd /home/admin/oceanbase
    -bash-4.2$ tree store/
    store/
    `-- obdemo
     |-- clog -> /data/log1/obdemo/clog
     |-- etc2 -> /data/log1/obdemo/etc2
     |-- etc3 -> /data/1/obdemo/etc3
     |-- ilog -> /data/log1/obdemo/ilog
     |-- oob_clog -> /data/log1/obdemo/oob_clog
     |-- slog -> /data/1/obdemo/slog
     |-- sort_dir -> /data/1/obdemo/sort_dir
     `-- sstable -> /data/1/obdemo/sstable
    
    9 directories, 0 files
    
  4. Optional. Test the I/O capabilities.

    Test the I/O capabilities of the data disk. The generated performance report file is stored under the /home/admin/oceanbase/etc directory. When the observer process starts, it will read this file and automatically set internal parameters related to I/O.

    Example:

    -bash-4.2$ time /home/admin/oceanbase/bin/ob_admin io_bench -c /home/admin/oceanbase/etc -d /data/1/obdemo user:root succ to open, filename=ob_admin.log, fd=3, wf_fd=2
    ...
    ...
    real    0m0.331s
    user    0m0.100s
    sys     0m0.262s
    
  5. Install OceanBase Client (OBClient).

    OceanBase Database instances are compatible with Oracle or MySQL. For an Oracle tenant, the Java driver file (oceanbase-client-*.jar) provided by OceanBase Database is required for Java program connections. To access an Oracle tenant on CLI, you also need to install OBClient.

    OBClient is a CLI client of OceanBase Database. Through OBClient, you can access MySQL and Oracle tenants of OceanBase Database.

    Example:

    -bash-4.2$ rpm -ivh obclient-1.2.6-20210510164331.el7.alios7.x86_64.rpm
    
    -- Verify whether OBClient has been installed.
    -bash-4.2$ which obclient
    /usr/bin/obclient
    

Initialize the OceanBase cluster

Note

The IP addresses in the sample code are for reference only. You need to enter the actual server IP address during deployment.

  1. Start the observer process on the nodes.

    Start the observer process as the admin user on each node.

    Notice

    With three replicas, the startup parameters are different for each node. When you start the observer process, you only need to specify three or more servers that run RootService, instead of all servers. You can add servers after the cluster is created.

    The parameters specify the data file size and memory size to accurately control the resource usage of OBServers when resources are insufficient in certain environments. The following table describes these parameters:

    Parameter Note
    -i The NIC name. You can use the ifconfig command to view the NIC name.
    -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. It can be modified.
    -d The primary directory of the cluster. Do not modify other fields except for the cluster name obdemo.
    -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 format of ip:2882:2881. Multiple items are separated with semicolons (;) to indicate RootService information. This parameter is consistent on the three servers.
    -o Specifies the cluster startup parameters, which need to be specified as needed. system_memory specifies the internal reserved memory of OceanBase Database, which is 30 GB by default. You can adjust this parameter to a smaller value in the case of insufficient memory on the server. The impact is that the 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 100 GB and reserve some spaces. If /data/1 and /data/log1 belong to the same file system (share the same disk), ensure 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.

    Examples:

    zone1:

    [root@xxx admin]# su - admin
    -bash-4.2$ cd /home/admin/oceanbase && /home/admin/oceanbase/bin/observer -i eth0 -P 2882 -p 2881 -z zone1 -d /home/admin/oceanbase/store/obdemo -r '10.10.10.1:2882:2881;10.10.10.2:2882:2881;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"
    devname: eth0
    rpc port: 2882
    mysql port: 2881
    zone: zone1
    data_dir: /home/admin/oceanbase/store/obdemo
    rs list: 10.10.10.1:2882:2881;10.10.10.2:2882:2881;10.10.10.3:2882:2881
    cluster id: 10001
    appname: obdemo
    optstr: system_memory=30G,datafile_size=500G,config_additional_dir=/data/1/obdemo/etc3;/data/log1/obdemo/etc2
    

    zone2:

    [root@xxx admin]# su - admin
    -bash-4.2$ cd /home/admin/oceanbase && /home/admin/oceanbase/bin/observer -i eth0 -P 2882 -p 2881 -z zone2 -d /home/admin/oceanbase/store/obdemo -r '10.10.10.1:2882:2881;10.10.10.2:2882:2881;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"
    devname: eth0
    rpc port: 2882
    mysql port: 2881
    zone: zone2
    data_dir: /home/admin/oceanbase/store/obdemo
    rs list: 10.10.10.1:2882:2881;10.10.10.2:2882:2881;10.10.10.3:2882:2881
    cluster id: 10001
    appname: obdemo
    optstr: system_memory=30G,datafile_size=500G,config_additional_dir=/data/1/obdemo/etc3;/data/log1/obdemo/etc2
    

    zone3:

    [root@xxx admin]# su - admin
    -bash-4.2$ cd /home/admin/oceanbase && /home/admin/oceanbase/bin/observer -i eth0 -P 2882 -p 2881 -z zone3 -d /home/admin/oceanbase/store/obdemo -r '10.10.10.1:2882:2881;10.10.10.2:2882:2881;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"
    devname: eth0
    rpc port: 2882
    mysql port: 2881
    zone: zone3
    data_dir: /home/admin/oceanbase/store/obdemo
    rs list: 10.10.10.1:2882:2881;10.10.10.2:2882:2881;10.10.10.3:2882:2881
    cluster id: 10001
    appname: obdemo
    optstr: system_memory=30G,datafile_size=500G,config_additional_dir=/data/1/obdemo/etc3;/data/log1/obdemo/etc2
    

    You can use the netstat -ntlp command to view whether the observer process has started. If ports 2881 and 2882 have been listened to, the observer process has started.````

    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      45576/observer
    tcp        0      0 0.0.0.0:2882            0.0.0.0:*               LISTEN      45576/observer
    tcp        0      0 127.0.0.1:9001          0.0.0.0:*               LISTEN      -
    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
    
  2. Perform the bootstrap operation on the cluster.

    Connect to any node by using the obclient command. The password is empty.

    [root@xxx admin]# obclient -h127.1 -uroot -P2881 -p
    Enter password:
    
    obclient> SET SESSION ob_query_timeout=1000000000;
    Query OK, 0 rows affected
    
    obclient> ALTER SYSTEM BOOTSTRAP ZONE 'zone1' SERVER '10.10.10.1:2882',ZONE 'zone2' SERVER '10.10.10.2:2882',ZONE 'zone3' SERVER '10.10.10.3:2882';
    Query OK, 0 rows affected
    

    Notice

    If an error is reported in this step, the reason may be that the startup parameter of the observer process is incorrect on the three nodes, the privileges on the directories related to the observer process are incorrect, the space of the log directory does not meet the required proportion, the time is not synchronous on the three nodes, or the node memory resources are insufficient. The log directory issue occurs because the log directory shares the same upper-level directory with the data directory, resulting in space occupation by the data directory. Check these problems and then clear the OceanBase Database directory. For more information, see Clear the Oceanbase Database directory (not required at the first deployment).

  3. Verify whether the cluster is initialized.

    After you perform the bootstrap operation and execute the SHOW DATABASES statement, if oceanbase appears in the database list, the cluster has been initialized.

    obclient> SHOW DATABASES;
    +--------------------+
    | Database           |
    +--------------------+
    | oceanbase          |
    | information_schema |
    | mysql              |
    | SYS                |
    | LBACSYS            |
    | ORAAUDITOR         |
    | test               |
    +--------------------+
    7 rows in set
    
  4. Change the password.

    By default, the password of the root user under the sys tenant is empty. After successful initialization, you need to change the password.

    obclient> ALTER USER root IDENTIFIED BY '**1***';
    Query OK, 0 rows affected
    

Initialize cluster parameters (Optional)

You can adjust the behaviors of the OceanBase cluster through parameters. Parameter modifications take effect immediately and are persisted to the parameter file observer.config.bin in the /home/admin/oceanbase/etc/ directory. The parameter file is a binary file, which will be displayed as garbled characters when being directly viewed. You need to use the strings command to view it.

Examples:

[root@xxx /]# cd /home/admin/oceanbase/etc
[root@xxx etc]# strings observer.config.bin|grep rootservice
rootservice_list=10.10.10.1:2882:2881;10.10.10.2:2882:2881;10.10.10.3:2882:2881

Alternatively, you can view parameters by using the SHOW PARAMETERS LIKE '%rootservice_list%'\G statement in the cluster.

Example:

obclient> SHOW PARAMETERS LIKE '%rootservice_list%'\G
*************************** 1. row ***************************
      zone: zone1
  svr_type: observer
    svr_ip: 10.10.10.1
  svr_port: 2882
      name: rootservice_list
 data_type: NULL
     value: 10.10.10.1:2882:2881;10.10.10.2:2882:2881;10.10.10.3:2882:2881
      info: a list of servers against which election candidate is checked for validation
   section: OBSERVER
     scope: CLUSTER
    source: DEFAULT
edit_level: DYNAMIC_EFFECTIVE
*************************** 2. row ***************************
      zone: zone3
  svr_type: observer
    svr_ip: 10.10.10.3
  svr_port: 2882
      name: rootservice_list
 data_type: NULL
     value: 10.10.10.1:2882:2881;10.10.10.2:2882:2881;10.10.10.3:2882:2881
      info: a list of servers against which election candidate is checked for validation
   section: OBSERVER
     scope: CLUSTER
    source: DEFAULT
edit_level: DYNAMIC_EFFECTIVE
*************************** 3. row ***************************
      zone: zone2
  svr_type: observer
    svr_ip: 10.10.10.2
  svr_port: 2882
      name: rootservice_list
 data_type: NULL
     value: 10.10.10.1:2882:2881;10.10.10.2:2882:2881;10.10.10.3:2882:2881
      info: a list of servers against which election candidate is checked for validation
   section: OBSERVER
     scope: CLUSTER
    source: DEFAULT
edit_level: DYNAMIC_EFFECTIVE
3 rows in set

If the space of the /home/admin directory is seriously insufficient, you can enable the system log recycling feature.

-bash-4.2$ obclient -h127.1 -uroot@sys -P2881 -p
Enter password:

-- Automatic log cleanup for OBServers
obclient> ALTER SYSTEM SET enable_syslog_recycle=True;
Query OK, 0 rows affected

obclient> ALTER SYSTEM SET max_syslog_file_count=10;
Query OK, 0 rows affected

obclient> SHOW PARAMETERS WHERE NAME IN ('enable_syslog_recycle', 'max_syslog_file_count')\G
*************************** 1. row ***************************
      zone: zone3
  svr_type: observer
    svr_ip: 10.10.10.3
  svr_port: 2882
      name: enable_syslog_recycle
 data_type: NULL
     value: False
      info: specifies whether log file recycling is turned on. Value: True: turned on; False: turned off
   section: OBSERVER
     scope: CLUSTER
    source: DEFAULT
edit_level: DYNAMIC_EFFECTIVE
*************************** 2. row ***************************
      zone: zone3
  svr_type: observer
    svr_ip: 10.10.10.3
  svr_port: 2882
      name: max_syslog_file_count
 data_type: NULL
     value: 0
      info: specifies the maximum number of the log files that can co-exist before the log file recycling kicks in. Each log file can occupy at most 256MB disk space. When this value is set to 0, no log file will be removed. Range: [0, +∞) in integer
   section: OBSERVER
     scope: CLUSTER
    source: DEFAULT
edit_level: DYNAMIC_EFFECTIVE
*************************** 3. row ***************************
      zone: zone1
  svr_type: observer
    svr_ip: 10.10.10.1
  svr_port: 2882
      name: enable_syslog_recycle
 data_type: NULL
     value: False
      info: specifies whether log file recycling is turned on. Value: True: turned on; False: turned off
   section: OBSERVER
     scope: CLUSTER
    source: DEFAULT
edit_level: DYNAMIC_EFFECTIVE
*************************** 4. row ***************************
      zone: zone1
  svr_type: observer
    svr_ip: 10.10.10.1
  svr_port: 2882
      name: max_syslog_file_count
 data_type: NULL
     value: 0
      info: specifies the maximum number of the log files that can co-exist before the log file recycling kicks in. Each log file can occupy at most 256MB disk space. When this value is set to 0, no log file will be removed. Range: [0, +∞) in integer
   section: OBSERVER
     scope: CLUSTER
    source: DEFAULT
edit_level: DYNAMIC_EFFECTIVE
*************************** 5. row ***************************
      zone: zone2
  svr_type: observer
    svr_ip: 10.10.10.2
  svr_port: 2882
      name: enable_syslog_recycle
 data_type: NULL
     value: False
      info: specifies whether log file recycling is turned on. Value: True: turned on; False: turned off
   section: OBSERVER
     scope: CLUSTER
    source: DEFAULT
edit_level: DYNAMIC_EFFECTIVE
*************************** 6. row ***************************
      zone: zone2
  svr_type: observer
    svr_ip: 10.10.10.2
  svr_port: 2882
      name: max_syslog_file_count
 data_type: NULL
     value: 0
      info: specifies the maximum number of the log files that can co-exist before the log file recycling kicks in. Each log file can occupy at most 256MB disk space. When this value is set to 0, no log file will be removed. Range: [0, +∞) in integer
   section: OBSERVER
     scope: CLUSTER
    source: DEFAULT
edit_level: DYNAMIC_EFFECTIVE
6 rows in set

Previous topic

Deploy a single-replica OceanBase cluster
Last

Next topic

Deploy OBProxy through the CLI
Next
What is on this page
Prerequisites
Procedure
Prepare the directory and install the software
Initialize the OceanBase cluster
Initialize cluster parameters (Optional)