Skip to main content

Physical standby tenant

tip

Physical standby tenant is available in ob-operator 2.1.0 and later versions.

This topic describes the physical standby tenant feature. This feature is available in OceanBase Database V4.x and provides your key applications with important capabilities such as high availability, data protection, and disaster recovery. It requires OBTenant and OBTenantOperation resources. You can use OBTenant resources to define tenants and OBTenantOperation resources to define tenant O&M operations. You can create a physical standby tenant from backup data or by creating an empty tenant. The physical standby tenant feature is closely related to the data restore feature.

Modify the configuration file

Parameters of a physical standby tenant are also contained in the OBTenant resource. For more information, see Restore data from a backup.

apiVersion: oceanbase.oceanbase.com/v1alpha1  
kind: OBTenant
metadata:
name: t1s
# namespace: oceanbase
spec:
obcluster: obcluster
tenantName: t1s
unitNum: 1
tenantRole: STANDBY
source:
restore:
bakDataSource:
# type: "NFS"
# path: "t1/dataBackup"
type: "OSS"
path: "oss://bucket/backup?host=oss-cn-hangzhou.aliyuncs.com"
ossAccessSecret: "oss-access"
archiveSource:
# type: "NFS"
# path: "t1/logArchive"
type: "OSS"
path: "oss://bucket/archive?host=oss-cn-hangzhou.aliyuncs.com"
ossAccessSecret: "oss-access"
until:
unlimited: true
replayLogUntil:
unlimited: true
tenant: t1
fields: values

The parameters are described as follows:

  • tenantRole: the role of the tenant. If you want to use the tenant as a standby tenant, set this parameter to STANDBY. The default value is PRIMARY.
  • source: the source of tenant data.
    • restore: the source of the backup data for restore.
    • tenant: the name of the primary tenant whose data will be synchronized to the created tenant.

Combined use of parameters

In the spec.source section of the configuration file of the OBTenant resource, the restore parameter specifies the information of the data restore source and the tenant parameter specifies the name of the primary tenant. The behavior of ob-operator varies based on the configuration of the two parameters.

  • If you specify both the restore and tenant parameters, ob-operator restores the standby tenant based on the configuration of the restore parameter, sets the log restore source of the standby tenant to the primary tenant, and replay the logs based on the values of the until and replayLogUntil parameters.
  • If you specify only the restore parameter, ob-operator restores the tenant based on the configuration of the restore parameter, and sets the tenant role as specified by the tenantRole parameter.
  • If you specify only the tenant parameter, ob-operator checks the existence of the specified tenant and the integrity of the log streams. If the check is passed, ob-operator creates an empty standby tenant and synchronizes the data from the specified primary tenant to the standby tenant.
  • If you specify neither the restore nor tenant parameter, the configuration file cannot be verified and cannot be applied to the cluster.

Tenant upgrade and switchover

For more information, see Perform tenant O&M operations.