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

KV - V4.3.5

  • OBKV overview
  • Architecture
  • OBKV-Table
    • Introduction to OBKV-Table
      • Overview
      • OBKV-Table operation types
      • Core features of OBKV-Table
      • Differences between replace and insert_or_update
      • Supported value types
      • OBKV-Table data models
    • Use the OBKV-Table Java client
      • Java development guide for OBKV-Table
      • Prepare for development with OBKV-Table
      • Use the OBKV-Table Java client to connect to a cluster
      • Set client parameters
      • Supported client interfaces
      • Use the OBKV-Table Java client
    • Use the OBKV-Table GO client
      • Use the OBKV-Table Go client to connect to a cluster
      • Overview of the Go client
      • Individual API operations
      • Batch operations
      • About queries
      • Aggregation API
      • Filters
    • FAQ
  • OBKV-HBase
    • Overview
    • OBKV-HBase core features
    • Compatibility with HBase
    • Deployment
    • Application development with OBKV-HBase
      • Overview of OBKV-HBase application development
      • Data model
      • Data model design
      • Connect to a cluster using the OBKV-HBase client
      • Migrate HBase business code to OBKV-HBase
      • Data operation examples
      • Delete expired data
    • OBKV-HBase migration guide
    • OBKV-HBase management
      • Overview
      • High availability
      • Security and permissions
      • Monitoring metrics
    • Performance test
    • OBKV-HBase integrations
      • Flink
        • Synchronize data to OBKV-HBase by using Flink
    • Views
    • FAQ

Download PDF

OBKV overview Architecture Overview OBKV-Table operation types Core features of OBKV-Table Differences between replace and insert_or_update Supported value types OBKV-Table data models Java development guide for OBKV-Table Prepare for development with OBKV-Table Use the OBKV-Table Java client to connect to a cluster Set client parameters Supported client interfaces Use the OBKV-Table Java client Use the OBKV-Table Go client to connect to a cluster Overview of the Go client Individual API operations Batch operations About queries Aggregation API Filters FAQ Overview OBKV-HBase core features Compatibility with HBase Deployment Overview of OBKV-HBase application development Data model Data model design Connect to a cluster using the OBKV-HBase client Migrate HBase business code to OBKV-HBase Data operation examples Delete expired data OBKV-HBase migration guide Overview High availability Security and permissions Monitoring metrics Performance test Views FAQ
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. KV
  4. V4.3.5
iconOceanBase Database
KV - V 4.3.5
SQL
KV
  • V 4.3.5

Use the OBKV-Table Go client to connect to a cluster

Last Updated:2025-09-08 11:41:13  Updated
share
What is on this page
Preparations
Import the obkv-table-client-go dependency
Connect the Go client to an OBServer node
Direct connection mode
ODP mode
.toml file configurations
ClientConfig

folded

share

This topic describes how to create a Go client instance. For more information about the Go client, visit GitHub wiki.

Note

We recommend that you use the latest version of the Go client. For more information about the latest version of the Go client, visit the Go client repository on GitHub.

Preparations

Before using the OBKV-Table client to connect to the OBKV-Table cluster for data processing, ensure that you have completed the following work:

  • Deployed an OceanBase cluster. For supported deployment plans, deployment methods, and detailed deployment procedures, see Deployment overview.

  • Created a MySQL tenant. For detailed instructions on creating a tenant, refer to Create a tenant.

  • Created a database. For detailed instructions on creating a database, refer to Create a database.

  • Created an OBKV-Table data table. For detailed instructions on creating an OBKV-Table data table, refer to OBKV-Table data models.

Below is a table creation example:

CREATE TABLE IF NOT EXISTS `test` (
    `c1` bigint(20) NOT NULL,
    `c2` bigint(20) NOT NULL,
    PRIMARY KEY (`c1`)
) PARTITION BY KEY(`c1`) PARTITIONS 10;

Import the obkv-table-client-go dependency

Run the following command on the local Go repository to obtain the obkv-table-client-go dependency of the latest version or a specified version:

go get github.com/oceanbase/obkv-table-client-go

Connect the Go client to an OBServer node

You can connect the Go client to an OBServer node in either of the following modes:

  • Direct connection mode: use a config server

  • OceanBase Database Proxy (ODP) mode

You can create a Go client from code or a .toml file on an OBServer node.

Direct connection mode

The syntax is as follows:

func NewClient(
    configUrl string,
    fullUserName string,
    password string,
    sysUserName string,
    sysPassWord string,
    cliConfig *config.ClientConfig) (Client, error) {

Input parameters:

  • configUrl: the URL for obtaining the RootServer list from the config server.
  • fullUserName: the full username, in the format of userName@tenantName#clusterName.
  • passWord: the password of the user specified by userName in fullUserName for accessing OceanBase Database.
  • sysUserName: the username of the user in the sys tenant. Only users in the sys tenant have privileges to access the routing table.
  • sysPassWord: the password of the user in the sys tenant.
  • cliConfig: the client configurations. For more information, see config.ClientConfig.

Response parameters:

  • Client: the client API, which contains insert, get, update, and other methods.
  • error: the error message.

ODP mode

The syntax is as follows:

func NewOdpClient(
    fullUserName string,
    passWord string,
    odpIP string,
    odpRpcPort int,
    database string,
    cliConfig *config.ClientConfig) (Client, error)

Input parameters:

  • fullUserName: the full username, in the format of userName@tenantName#clusterName.
  • passWord: the password of the user specified by userName in fullUserName for accessing OceanBase Database.
  • odpIP: the IP address of ODP.
  • odpRpcPort: the RPC port number of ODP.
  • database: the name of the database to connect to.
  • cliConfig: the client configurations. For more information, see config.ClientConfig.

Response parameters:

  • Client: the client API, which contains insert, get, update, and other methods.
  • error: the error message.

.toml file configurations

The obkv-table-default.toml file is stored in the /configurations directory.

You can choose to specify the parameters in the Direct mode or ODP mode section in the .toml file. For more information about other parameters, see config.ClientConfig.

The syntax is as follows:

func NewClientWithTomlConfig(configFilePath string) (Client, error)

Input parameter:

  • configFilePath: the path of the .toml file.

Response parameters:

  • Client: the client API, which contains insert, get, update, and other methods.
  • error: the error message.

ClientConfig

The syntax is as follows:

type ClientConfig struct {
    ConnPoolMaxConnSize int
    ConnConnectTimeOut  time.Duration
    ConnLoginTimeout    time.Duration
    OperationTimeOut    time.Duration
    LogLevel            log.Level

    TableEntryRefreshLockTimeout     time.Duration
    TableEntryRefreshTryTimes        int
    TableEntryRefreshIntervalBase    time.Duration
    TableEntryRefreshIntervalCeiling time.Duration

    MetadataRefreshInterval    time.Duration
    MetadataRefreshLockTimeout time.Duration

    RsListLocalFileLocation    string
    RsListHttpGetTimeout       time.Duration
    RsListHttpGetRetryTimes    int
    RsListHttpGetRetryInterval time.Duration

    EnableRerouting bool
}

The special parameters are described as follows:

  • ConnPoolMaxConnSize: the number of connections in the connection pool. The default value is 1.
  • ConnConnectTimeOut: the timeout period for a TCP connection. The default value is 1s.
  • ConnLoginTimeout: the timeout period for an authentication operation. The default value is 1s.
  • OperationTimeOut: the timeout period for a single request. The default value is 10s.
  • EnableRerouting: specifies whether to enable rerouting. By default, rerouting is disabled.

Previous topic

Use the OBKV-Table Java client
Last

Next topic

Overview of the Go client
Next
What is on this page
Preparations
Import the obkv-table-client-go dependency
Connect the Go client to an OBServer node
Direct connection mode
ODP mode
.toml file configurations
ClientConfig