To describe the types and distribution strategies of multiple replicas of data, we introduce the concept of Locality. OceanBase Database only supports tenant-level Locality in the current version and does not support configuring Locality at the table, database, or table group level.
A replica refers to data, while Locality describes the container that holds the data. Therefore, the data within the container inherits the Locality attributes of the container, including its type and distribution strategy.
OceanBase Database only supports tenant-level Locality in the current version. However, OceanBase Database V3.x also supports configuring Locality at the table, database, and table group levels.
Syntax
The syntax for Locality is as follows:
replicas{quantifier}@location
The elements in the syntax are described in the following table:
Element |
Description |
|---|---|
| replicas | Specifies the replica type. The value of replicas is the replica name, which can be obtained from the Name column of the replica type description table in Replica types. It supports both full names and abbreviations. |
| location | Specifies the location. It is a set of known enumeration values in the system. The value of location is the name of a zone. You can query the zone names in the oceanbase.DBA_OB_ZONES view for a cluster or a tenant.For more information about the DBA_OB_ZONES view, see oceanbase.DBA_OB_ZONES. |
| quantifier | Fixed at 1, indicating one replica. It is optional. |
You can view the Locality attribute of a tenant in the LOCALITY column of the oceanbase.DBA_OB_TENANTS view in the sys tenant. Example:
obclient(root@sys)[oceanbase]> SELECT TENANT_ID, TENANT_NAME, TENANT_TYPE, CREATE_TIME, PRIMARY_ZONE, LOCALITY, COMPATIBILITY_MODE, STATUS FROM oceanbase.DBA_OB_TENANTS;
The query result is as follows:
+-----------+-------------+-------------+----------------------------+--------------+----------------------------------------------+--------------------+--------+
| TENANT_ID | TENANT_NAME | TENANT_TYPE | CREATE_TIME | PRIMARY_ZONE | LOCALITY | COMPATIBILITY_MODE | STATUS |
+-----------+-------------+-------------+----------------------------+--------------+----------------------------------------------+--------------------+--------+
| 1 | sys | SYS | 2025-12-29 15:43:42.930290 | RANDOM | FULL{1}@zone1 | MYSQL | NORMAL |
| 1001 | META$1002 | META | 2025-12-29 15:44:48.700796 | zone1;zone2 | FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3 | MYSQL | NORMAL |
| 1002 | mysql001 | USER | 2025-12-29 15:44:48.704354 | zone1;zone2 | FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3 | MYSQL | NORMAL |
| 1003 | META$1004 | META | 2025-12-29 15:50:35.033311 | zone1 | FULL{1}@zone1 | MYSQL | NORMAL |
| 1004 | oracle001 | USER | 2025-12-29 15:50:35.034367 | zone1 | FULL{1}@zone1 | ORACLE | NORMAL |
+-----------+-------------+-------------+----------------------------+--------------+----------------------------------------------+--------------------+--------+
5 rows in set
Examples
The following example shows how to configure different Locality attributes for multiple tenants in an OceanBase cluster with five zones (z1 to z5):
The Locality attribute of the sys tenant is
F@z1,F@z2,F@z3,F@z4,F@z5.This indicates that the sys tenant has a full-featured replica in each of the zones z1, z2, z3, z4, and z5.
The Locality attribute of tenant1 is
F@z1,F@z2,F@z3.This indicates that tenant1 has a full-featured replica in each of the zones z1, z2, and z3.
The Locality attribute of tenant2 is
F@z3,F@z4,F@z5.This indicates that tenant2 has a full-featured replica in each of the zones z3, z4, and z5.
The following figure shows the distribution of replicas in the cluster:

Locality and high availability architecture
The multi-replica architecture is a key architectural advantage of OceanBase Database over traditional databases. This architecture forms the foundation for OceanBase Database's multi-tiered lossless disaster recovery capabilities, including single-node, IDC, and regional lossless disaster recovery. OceanBase Database allows for flexible adjustments to the cluster deployment architecture to meet the evolving technical requirements of different business scenarios.
The flexible deployment architecture of OceanBase Database is reflected through the Locality attribute, which not only describes the replica type but also outlines the distribution strategy of replicas across zones. Zones have a Region attribute, which can be viewed in the REGION column of the oceanbase.DBA_OB_ZONES view. This attribute describes the geographical distribution of the zone. By adjusting the distribution of replicas across different zones in various regions, OceanBase Database achieves flexible deployment.
OceanBase Database supports three typical deployment modes: three IDCs in the same city, three IDCs in two regions, and five IDCs in three regions. Here are some examples of Locality attributes for these modes:
Deployment mode |
Locality attribute |
Zone distribution |
|---|---|---|
| Three IDCs in the same city | F@z1,F@z2,F@z3 |
z1, z2, and z3 are located in IDCs idc1, idc2, and idc3 of Region R1, respectively. |
| Three IDCs in two regions | F@z1,F@z2,F@z3,F@z4,F@z5 |
z1 and z2 are located in IDC idc1 of Region R1; z3 and z4 are located in IDC idc2 of Region R1; z5 is located in Region R2. |
| Five IDCs in three regions | F@z1,F@z2,F@z3,F@z4,F@z5 |
z1 and z2 are located in IDCs idc1 and idc2 of Region R1; z3 and z4 are located in IDCs idc3 and idc4 of Region R2; z5 is located in Region R3. |
