OceanBase Database uses a multi-tenant architecture. In version earlier than V4.0.0, OceanBase Database supports only two types of tenants: sys tenants and user tenants. Since OceanBase Database V4.0.0, the concept of meta tenant is introduced. Therefore, OceanBase Database now supports three types of tenants that are visible to users: sys tenant, user tenant, and meta tenant.
sys tenant
A sys tenant is the default tenant created for a cluster. Its lifecycle is consistent with that of the cluster. A sys tenant manages the lifecycle of the cluster and all tenants. A sys tenant has only one No.1 log stream, which supports only single-point write and cannot be scaled up.
You can create user tables in a sys tenant. All user tables and system tables are served by the No.1 log stream. The data of a sys tenants is cluster-specific and does not support physical synchronization or backup and restore between the primary and secondary clusters.
User tenant
A user tenant is a tenant created by a user. It provides complete database features and supports two compatibility modes: MySQL mode and Oracle mode. A user tenant supports horizontal service capability expansion across multiple machines, dynamic scale-in and scale-out, and automatic creation and deletion of log streams based on user configurations.
A user tenant has higher data protection and availability requirements, and therefore supports physical synchronization and physical backup and restore across clusters. Typical data that supports physical synchronization and physical backup and restore across clusters includes schema data, user table data, and transaction data.
Applicability
OceanBase Database Community Edition provides only the MySQL mode.
Meta tenant
Meta tenants are used for internal management in OceanBase Database. When you create a user tenant, the system automatically creates a corresponding meta tenant. The lifecycle of a meta tenant is the same as that of its user tenant.
A meta tenant stores and manages private data of clusters of a user tenant, which includes parameters, location information, replica information, log stream status, backup and restore information, and major compaction information. This part of data does not require physical data synchronization or physical backup and restore across clusters.
Comparison between different types of tenants
The following table lists the differences among sys tenants, user tenants, and meta tenants from the user perspective.
| Attribute | sys tenant | User tenant | Meta tenant |
|---|---|---|---|
| Tenant ID | 1 |
|
|
| Tenant naming conventions | sys | Defined by the user, containing upper- and lower-case letters, digits, and underscores (_). | META${user_tenant_id}For example, if the user tenant ID is 1002, and the name of the corresponding meta tenant is META$1002. |
| Tenant type | sys | User | Meta |
| Data property | Private data of clusters. Physical data synchronization between the primary and standby clusters, and physical data backup and restore are not supported. | Non-private data of clusters. Physical data synchronization between the primary and standby clusters, and physical data backup and restore are supported. | Private data of clusters. Physical data synchronization between the primary and standby clusters, and physical data backup and restore are not supported. |
| Scalability | Horizontal scaling is not supported. Only one log stream is available. | Horizontal and dynamic scaling are supported. | Horizontal scaling is not supported. Only one log stream is available. |
| Tenant O&M |
|
|
|
| External data access interface | Views in the sys tenant |
|
You cannot log on to a meta tenant. To view the data on a meta tenant, you can access it from a user tenant or the sys tenant.
|
Tenant architecture
The following figure shows the tenant architecture. Each user tenant corresponds to a meta tenant. Both the sys tenant and the meta tenant have only one No.1 log stream. A user tenant allows you to dynamically create and delete log streams.
