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

Kubernetes operator for OceanBase

V2.3.1Community Edition

  • Overview
  • Quick start
  • Deploy
  • Upgrade
  • User guide
    • Cluster management
      • Manage clusters
      • Create a cluster
      • Zone management
        • Add zones to a cluster
        • Delete zones from a cluster
      • Server management
        • Add OBServer nodes to zones
        • Delete OBServer nodes from zones
      • Upgrade a cluster
      • Manage parameters
      • Update resources
      • Delete a cluster
    • Tenant management
      • Manage tenants
      • Create a tenant
      • Modify tenant
        • Manage resources
        • Manage replicas
        • Modify other parameters
      • Delete a tenant
      • Perform tenant O&M operations
    • High availability
      • High availability
      • Recover from node failure
      • Back up a tenant
      • Restore data from a backup
      • Physical standby tenant
      • Inter K8s cluster management
  • Configure
  • Appendix
    • Deploy OceanBase Database and web app in a Kubernetes cluster
    • FAQ
  • Changelog

Download PDF

Overview Quick start Deploy Upgrade Manage clusters Create a cluster Upgrade a cluster Manage parameters Update resources Delete a cluster Manage tenants Create a tenant Delete a tenant Perform tenant O&M operations High availability Recover from node failure Back up a tenant Restore data from a backup Physical standby tenant Inter K8s cluster management Configure Deploy OceanBase Database and web app in a Kubernetes cluster FAQ Changelog
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. Kubernetes operator for OceanBase
  3. V2.3.1
iconKubernetes operator for OceanBase
V 2.3.1Community Edition
Community Edition
  • V 2.3.1
  • V 2.3.0
  • V 2.2.0
  • V 2.1.2
  • V 2.1.1
  • V 2.1.0

Manage replicas

Last Updated:2025-11-28 06:07:04  Updated
share
What is on this page
Modify the primary zone of a tenant
Procedure
Modify the locality of a tenant
Add replicas
Prerequisites
Procedure
Delete replicas
Procedure

folded

share

This topic describes how to manage tenant replicas by using ob-operator.

Modify the primary zone of a tenant

You can modify the priority parameter of zones in the tenant configuration file to modify the primary zone of a tenant. A larger number indicates a higher priority. The minimum value is 1.

The primary zone describes the preferred location of the leader. The leader handles strong-consistency read traffic and write traffic of the business. Therefore, the primary zone determines the traffic distribution of OceanBase Database. You can modify the primary zone to switch business traffic from one IDC to another or from one city to another in disaster recovery and scaling scenarios.

Procedure

  1. Modify the tenant configuration file tenant.yaml to adjust the priority value for each zone.

    - zone: zone1
      priority: 1
    - zone: zone2
      priority: 1
    - zone: zone3
      priority: 3
    
    # After modification
    - zone: zone1
      priority: 3
    - zone: zone2
      @priority 2
    - zone: zone3
      priority: 1
    

    The preceding configuration changes the primary zone of the tenant from zone3;zone1,zone2 to zone1;zone2;zone3.

  2. Run the following command for the modification to take effect:

    kubectl apply -f tenant.yaml
    
  3. Run the following command to view the custom resources of the tenant in the current Kubernetes cluster to check whether the modification is successful:

    kubectl get obtenants.oceanbase.oceanbase.com -n oceanbase -o yaml
    

    If the value of the corresponding parameter in the status.resourcePool.priority section in the custom resources of the tenant is changed to the new value, the modification is successful.

    status:
      ...
      resourcePool:
        - zone: zone1
          priority: 3
        - zone: zone2
          @priority 2
        - zone: zone3
          priority: 1
    

    You can also run the following command to view the result.

    kubectl get obtenants.oceanbase.oceanbase.com -n oceanbase -o wide
    

    The command output is as follows:

    NAME   STATUS    TENANTNAME   TENANTROLE   CLUSTERNAME   AGE   LOCALITY   PRIMARYZONE           POOLLIST    CHARSET
    t1     running   t1           PRIMARY      obcluster     13m   ...        zone1;zone2;zone3     ...         utf8mb4
    

    The result shows that the value of the PRIMARYZONE field is modified to zone1;zone2;zone3, which matches the priority configuration.

Modify the locality of a tenant

To modify the locality of a tenant, you can modify the parameters in the type section to specify the replica type and the number of replicas. The following replica types are supported: full, logonly, and readonly.

For more information, see [Modify the primary zone of a tenant](# Modify the primary zone of a tenant).

Modify the tenant configuration file tenant.yaml:

 type:
    name: Full # The Full and Readonly replica types are supported.
    replica: 1

Add replicas

Prerequisites

  • You have added a zone to the cluster. For more information, see Add zones to a cluster.

Procedure

You can add zones to a tenant by modifying the tenant configuration file tenant.yaml.

Assume that the current cluster has four zones, zone1, zone2, zone3, and zone4, the zones corresponding to the tenant are zone1, zone2, and zone3, and you want to scale out the tenant to four zones.

  1. Modify the configuration file tenant.yaml to add zone4.

    # For example, the tenant has three zones.
    pools:
      - zone: zone1
        unitNum: 1
        type:
          name: Full
          replica: 1
        priority: 3
        resource:
          ...
      - zone: zone2
        unitNum: 1
        type:
          name: Full
          replica: 1
        priority: 3
        resource:
          ...
      - zone: zone3
        unitNum: 1
        type:
          name: Full
          replica: 1
        priority: 3
        resource:
          ...
    
    # Add zone4 to the tenant.
    pools:
      - zone: zone1
        unitNum: 1
        type:
          name: Full
          replica: 1
        priority: 3
        resource:
          ...
      - zone: zone2
        unitNum: 1
        type:
          name: Full
          replica: 1
        priority: 3
        resource:
          ...
      - zone: zone3
        unitNum: 1
        type:
          name: Full
          replica: 1
        priority: 3
        resource:
          ...
      - zone: zone4
        unitNum: 1
        type:
          name: Full
          replica: 1
        priority: 3
        resource:
          ...
    
  2. Run the following command for the modification to take effect:

    kubectl apply -f tenant.yaml
    
  3. Run the following command to view the custom resources of the tenant in the current Kubernetes cluster:

    kubectl get obtenants.oceanbase.oceanbase.com -n oceanbase -o wide
    

    The following command output shows that the value of the LOCALITY field is as expected:

    NAME   STATUS    TENANTNAME   TENANTROLE   CLUSTERNAME   AGE   LOCALITY                                                       PRIMARYZONE           POOLLIST    CHARSET
    t1     running   t1           PRIMARY      obcluster     19m   FULL{1}@zone1,FULL{1}@zone2,FULL{1}@zone3,FULL{1}@zone4        ...                   ...         utf8mb4
    

Delete replicas

Procedure

You can modify the tenant configuration file tenant.yaml to delete zones from a tenant.

Assume that the current cluster has four zones, zone1, zone2, zone3, and zone4, the zones corresponding to the tenant are zone1, zone2, zone3, and zone4, and you want to scale in the tenant to zone1, zone2, and zone3.

  1. Modify the configuration file tenant.yaml to delete zone4.

    # For example, the tenant has four zones.
    pools:
      - zone: zone1
        unitNum: 1
        type:
          name: Full
          replica: 1
        priority: 3
        resource:
          ...
      - zone: zone2
        unitNum: 1
        type:
          name: Full
          replica: 1
        priority: 3
        resource:
          ...
      - zone: zone3
        unitNum: 1
        type:
          name: Full
          replica: 1
        priority: 3
        resource:
          ...
      - zone: zone4
        unitNum: 1
        type:
          name: Full
          replica: 1
        priority: 3
        resource:
          ...
    
    # Delete zone4 from the tenant.
    pools:
      - zone: zone1
        unitNum: 1
        type:
          name: Full
          replica: 1
        priority: 3
        resource:
          ...
      - zone: zone2
        unitNum: 1
        type:
          name: Full
          replica: 1
        priority: 3
        resource:
          ...
      - zone: zone3
        unitNum: 1
        type:
          name: Full
          replica: 1
        priority: 3
        resource:
          ...
    
  2. Run the following command for the modification to take effect:

    kubectl apply -f tenant.yaml
    
  3. Run the following command to view the custom resources of the tenant in the current Kubernetes cluster:

    kubectl get obtenants.oceanbase.oceanbase.com -n oceanbase -o wide
    

    The following command output shows that the value of the LOCALITY field is as expected:

    NAME   STATUS    TENANTNAME   TENANTROLE   CLUSTERNAME   AGE   LOCALITY                                     PRIMARYZONE     POOLLIST    CHARSET
    t1     running   t1           PRIMARY      obcluster     25m   FULL{1}@zone1,FULL{1}@zone2,FULL{1}@zone3    ...             ...         utf8mb4
    

Previous topic

Manage resources
Last

Next topic

Modify other parameters
Next
What is on this page
Modify the primary zone of a tenant
Procedure
Modify the locality of a tenant
Add replicas
Prerequisites
Procedure
Delete replicas
Procedure