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 Proxy

V4.2.0Community Edition

  • What is ODP?
  • Installation and deployment
    • Deploy ODP by using OBD
    • Deploy ODP by using OCP
    • Deploy ODP by using the CLI
    • Deployment modes
  • Basic operations
  • Configuration parameter
    • Parameter description
    • Dynamically modifiable parameters
    • Parameters that are not dynamically modifiable
    • Internal and inherited parameters
    • In-memory parameters
  • Connection management
    • Principles
    • Session status synchronization
    • Client session
    • Server session
  • Data routing
    • Factors affecting data routing
    • Routing strategies
    • ODP routing
    • Intra-tenant routing
    • Read/Write separation
    • Follower latency threshold
  • High availability mechanism
    • Overview
    • High availability of ODP services
    • High availability of OceanBase Database
    • High availability testing
  • Security and protocols
  • Operation and maintenance
    • Troubleshooting
      • Troubleshooting logic
      • Monitoring logs
    • Performance analysis
    • Show Trace

Download PDF

What is ODP? Deploy ODP by using OBD Deploy ODP by using OCP Deploy ODP by using the CLI Deployment modes Basic operations Parameter description Dynamically modifiable parameters Parameters that are not dynamically modifiable Internal and inherited parameters In-memory parameters Principles Session status synchronization Client session Server session Factors affecting data routing Routing strategies ODP routing Intra-tenant routing Read/Write separation Follower latency threshold Overview High availability of ODP services High availability of OceanBase Database High availability testing Security and protocols Troubleshooting logic Monitoring logs Performance analysis Show Trace
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 Proxy
  3. V4.2.0
iconOceanBase Database Proxy
V 4.2.0Community Edition
  • V 4.3.6
  • V 4.3.4
  • V 4.3.3
  • V 4.3.2
  • V 4.3.1
  • V 4.3.0
  • V 4.2.3
  • V 4.2.2
  • V 4.2.0 and earlier
Community Edition
  • V 4.2.0
  • V 4.1.0
  • V 4.0.0
  • V 3.1.0

Read/Write separation

Last Updated:2023-10-10 02:43:33  Updated
share
What is on this page
Introduction
Configure read/write separation
Configure weak-consistency read
Configure the routing strategy

folded

share

Introduction

In read/write separation, after data is modified on the primary server, the modification will be synchronized to the standby server. The standby server can only provide data read but not data write. Read/write separation improves database performance and server security while achieving backup.

For a standalone database such as MySQL, read/write separation refers to sending write requests to the primary server and read requests to the standby server. For OceanBase Database, we refine read/write separation from the server level to the partition level, which is a unique advantage of OceanBase Database.

With the read/write separation feature, read requests can be sent to followers to reduce the stress on the leader.

Notice

After read/write separation is enabled, read requests may not read the latest data.

Configure read/write separation

To use read/write separation, perform the following steps:

  • Configure weak-consistency read for SQL statements. A weak-consistency read request does not need to read the latest data. Strong-consistency read is enabled for general SQL statements and weak-consistency read requires additional configuration.

  • Configure the routing strategy. For example, for Partition 1 in the following figure, the three replicas, including the leader, can provide weak-consistency read services. You can configure the routing strategy so that read requests are preferentially routed to the followers.

    Partition 1

Configure weak-consistency read

Configure weak-consistency read by using a hint

You can add the /*+READ_CONSISTENCY(WEAK)*/ hint to SQL statements to enable weak-consistency read for the statements. Example:

select /*+READ_CONSISTENCY(WEAK)*/ * from t1;

Configure weak-consistency read by using a parameter

To configure weak-consistency read by using a hint, you must modify the SQL statements, which can be complex sometimes. Alternatively, you can change the value of the obproxy_read_consistency parameter to configure weak-consistency read. To do this, perform the following steps:

  1. Log on to the database by using the administrator account (root@proxysys) of OceanBase Database Proxy (ODP).

  2. Run the following statement:

    alter proxyconfig set obproxy_read_consistency = 1;
    

    The values of the obproxy_read_consistency parameter are as follows:

    • 0 (default value): to enable strong-consistency read. A strong-consistency read request reads the latest data.

    • 1: to enable weak-consistency read. A weak-consistency read request does not need to read the latest data.

Configure the routing strategy

Configure the routing strategy through the proxy_route_policy parameter. The values of this parameter are as follows:

  • follower_first: Weak-consistency read requests are preferentially routed to followers. If all the followers are unavailable, the requests are routed to the leader.

  • follower_only: Weak-consistency read requests are routed to the followers. If all the followers are unavailable, the connection to the client is terminated.

Previous topic

Intra-tenant routing
Last

Next topic

Follower latency threshold
Next
What is on this page
Introduction
Configure read/write separation
Configure weak-consistency read
Configure the routing strategy