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.3.3

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive 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.3.3
    iconOceanBase Database
    SQL - V 4.3.3
    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

    Quick start

    Last Updated:2025-01-20 07:11:07  Updated
    share
    What is on this page
    Environment requirements
    Procedure

    folded

    share

    Environment requirements

    OceanBase Shell (obshell) in the environment must be running.

    Procedure

    1. Install obshell-sdk-go.

      go get github.com/oceanbase/obshell-sdk-go
      
    2. Create a client instance.

      You can create a client instance of a specified version or a set of client instances of different versions.

      Create a client instance of a specified version
      Create a set of client instances of different versions
      package main
      
      import (
          "github.com/oceanbase/obshell-sdk-go/services/v1"
      )
      
      func main() {
          client, err := v1.NewClientWithPassword("10.10.10.1", 2886, "${password}")
          if err != nil {
              // Handle exceptions
              panic(err)
           }
      }
      
      package main
      
      import (
          "github.com/oceanbase/obshell-sdk-go/services"
      )
      
      func main() {
          clientset, err := services.NewClientWithPassword("10.10.10.1", 2886, "${password}")
          if err != nil {
              // Handle exceptions
              panic(err)
          }
      }
      

      In this example, 10.10.10.1 and 2886 are respectively the IP address and port number of the target obshell node. You can modify them as needed. ${password} must be the password of the root@sys user of the cluster where the target obshell node belongs.

    3. Deploy an OceanBase cluster.

      obshell-sdk-go enables you to deploy an OceanBase cluster in two ways: asynchronous task execution and synchronous task execution. For asynchronous task execution, a response is returned immediately after an API request is successfully sent to obshell. For synchronous task execution, a response is returned only after an API request is successfully sent to obshell and the obshell task is completed.

      The following sample code deploys a cluster that contains three zones with one server in each zone:

      Asynchronous task execution
      Synchronous task execution
      package main
      
       import (
           "github.com/oceanbase/obshell-sdk-go/services"
           "github.com/oceanbase/obshell-sdk-go/services/v1"
       )
      
       func main() {
           client, err := services.NewClientWithPassword("10.10.10.1", 2886, "****")
           if err != nil {
               return
           }
      
           // Join the current node to the cluster as Master Agent.
           joinRequest1 := client.V1().NewJoinRequest("10.10.10.1", 2886, "zone1")
           dag, err := client.V1().JoinSyncWithRequest(joinRequest1) // Handle errors in the production environment. The following similar code serves the same purpose.
           _, err = client.V1().WaitDagSucceed(dag.GenericID)
      
           // Join other nodes to the cluster as Follower Agent.
           joinRequest2 := client.V1().NewJoinRequest("10.10.10.2", 2886, "zone2")
           dag, err = client.V1().JoinSyncWithRequest(joinRequest2)
           _, err = client.V1().WaitDagSucceed(dag.GenericID)
      
           joinRequest3 := client.V1().NewJoinRequest("10.10.10.3", 2886, "zone3")
           dag, err = client.V1().JoinSyncWithRequest(joinRequest3)
           _, err = client.V1().WaitDagSucceed(dag.GenericID)
      
           // obshell prior to 4.2.3.0 should use mysqlPort(rpcPort) instead of mysql_port(rpc_port).
           configs := map[string]string{
               "mysql_port": "2881", "rpc_port": "2882", "datafile_size": "24G", "cpu_count": "16", "memory_limit": "16G", "system_memory": "8G", "log_disk_size": "24G",
           }
           // Set configurations for each OBServer node.
           configObserverReq := client.V1().NewConfigObserverRequest(configs, v1.SCOPE_GLOBAL)
           dag, err = client.V1().ConfigObserverSyncWithRequest(configObserverReq)
           _, err = client.V1().WaitDagSucceed(dag.GenericID)
      
           // Set configurations for the OceanBase cluster.
           configObclusterReq := client.V1().NewConfigObclusterRequest("obshell-sdk-test", 12358).SetRootPwd("****")
           dag, err = client.V1().ConfigObclusterSyncWithRequest(configObclusterReq)
           _, err = client.V1().WaitDagSucceed(dag.GenericID)
      
           // Initialize the cluster.
           initReq := client.V1().NewInitRequest()
           dag, err = client.V1().InitSyncWithRequest(initReq)
           _, err = client.V1().WaitDagSucceed(dag.GenericID)
       }
      
      package main
      
       import (
           "github.com/oceanbase/obshell-sdk-go/services"
           "github.com/oceanbase/obshell-sdk-go/services/v1"
       )
      
       func main() {
           client, err := services.NewClientWithPassword("10.10.10.1", 2886, "****")
           if err != nil {
               return
           }
      
           // Join the current node to the cluster as Master Agent.
           joinRequest1 := client.V1().NewJoinRequest("10.10.10.1", 2886, "zone1")
           _, err = client.V1().JoinSyncWithRequest(joinRequest1) // Handle errors in the production environment. The following similar code serves the same purpose.
      
           // Join other nodes to the cluster as Follower Agent.
           joinRequest2 := client.V1().NewJoinRequest("10.10.10.2", 2886, "zone2")
           _, err = client.V1().JoinSyncWithRequest(joinRequest2)
      
           joinRequest3 := client.V1().NewJoinRequest("10.10.10.3", 2886, "zone3")
           _, err = client.V1().JoinSyncWithRequest(joinRequest3)
      
           // obshell prior to 4.2.3.0 should use mysqlPort(rpcPort) instead of mysql_port(rpc_port).
           configs := map[string]string{
               "mysql_port": "2881", "rpc_port": "2882", "datafile_size": "24G", "cpu_count": "16", "memory_limit": "16G", "system_memory": "8G", "log_disk_size": "24G",
           }
           // Set configurations for each OBServer node.
           configObserverReq := client.V1().NewConfigObserverRequest(configs, v1.SCOPE_GLOBAL)
           _, err = client.V1().ConfigObserverSyncWithRequest(configObserverReq)
      
           // Set configurations for the OceanBase cluster.
           configObclusterReq := client.V1().NewConfigObclusterRequest("obshell-sdk-test", 12358).SetRootPwd("****")
           _, err = client.V1().ConfigObclusterSyncWithRequest(configObclusterReq)
      
           // Initialize the cluster.
           initReq := client.V1().NewInitRequest()
           _, err = client.V1().InitSyncWithRequest(initReq)
       }
      

    Previous topic

    Create a cluster
    Last

    Next topic

    Add a node before cluster initialization
    Next
    What is on this page
    Environment requirements
    Procedure