Cloud Native 8 min read

How to Back Up OceanBase 4.2.5 on Kubernetes to Baidu Cloud BOS (S3)

This guide walks you through upgrading the ob‑operator, creating S3 credentials, configuring an OBTenantBackupPolicy YAML, applying the backup, and verifying the backup status to achieve a full data backup of an OceanBase 4.2.5 tenant to Baidu Cloud BOS using Kubernetes.

Xiaolei Talks DB
Xiaolei Talks DB
Xiaolei Talks DB
How to Back Up OceanBase 4.2.5 on Kubernetes to Baidu Cloud BOS (S3)

1. Backup Version Requirements

Target OceanBase version: 4.2.5. Required ob‑operator version: 2.3.0. Backup medium: Baidu Cloud Object Storage (BOS) using the S3 protocol.

OceanBase has supported NFS, Alibaba OSS, Tencent COS, and since version 4.2.1 BP7 also AWS S3 and other S3‑compatible storages such as Baidu BOS, Huawei OBS, and Google GCS. Different OB and operator versions, as well as backup media, require different configurations.

2. Preparation

The existing operator (2.2.0) must be upgraded to 2.3.0 to support S3‑compatible storage.

<code>wget https://raw.githubusercontent.com/oceanbase/ob-operator/2.3.0_release/deploy/operator.yaml
kubectl apply -f operator-230.yaml -n oceanbase-system</code>

3. Backup Procedure

(1) Create a secret that holds the Baidu S3 access credentials.

<code>kubectl create secret generic access-s3 \
  --from-literal=accessId=xxxx \
  --from-literal=accessKey=xxxx \
  --from-literal=s3Region=xxx \
  -n oceanbase-test1</code>

(2) Write the ob-backup.yaml (OBTenantBackupPolicy) specifying the S3 destination for log archive and data backup.

<code>apiVersion: oceanbase.oceanbase.com/v1alpha1
kind: OBTenantBackupPolicy
metadata:
  name: obtenant-bp-s3
  namespace: oceanbase-test1
spec:
  obClusterName: obcluster
  tenantCRName: oceanbase
  jobKeepWindow: "1d"
  dataClean:
    recoveryWindow: "8d"
  logArchive:
    destination:
      type: "S3"
      path: "s3://backup-s3/oblog-backup?host=s3.xxxx.com"
      ossAccessSecret: "access-s3"
    switchPieceInterval: "1d"
  dataBackup:
    destination:
      type: "S3"
      path: "s3://backup-s3/obdata-backup?host=s3.xxxx.com"
      ossAccessSecret: "access-s3"
    fullCrontab: "2 17 * * 6"
    incrementalCrontab: "30 18 * * *"</code>

Key fields explained (e.g., obClusterName , tenantCRName , jobKeepWindow , dataClean , logArchive , dataBackup , crontab schedules, etc.).

Current tenant information (illustrated below):

(3) Apply the backup policy (first run triggers an immediate backup).

<code>kubectl apply -f ob-backup.yaml -n oceanbase-test1
obtenantbackuppolicy.oceanbase.oceanbase.com/obtenant-bp-s3 created</code>

(4) Check backup status. The main resources are OBTenantBackupPolicy and OBTenantBackup , representing the backup strategy and the backup jobs respectively.

<code># kubectl get -A OBTenantBackupPolicy
NAMESPACE         NAME             STATUS    AGE   TENANTNAME   NEXTFULL   NEXTINCREMENTAL   FULLCRONTAB   INCREMENTALCRONTAB
oceanbase-test1   obtenant-bp-s3   RUNNING   58s   dxltest      2024-11-13 17:01:49   2 17 * * *   30 18 * * *</code>

If a backup fails, delete the policy and re‑apply it. Failure often occurs because a query returns NULL for a string column during archive progress checking.

<code># kubectl delete OBTenantBackupPolicy obtenant-bp-s3 -n oceanbase-test1
# kubectl apply -f ob-backup.yaml -n oceanbase-test1</code>

(5) After execution, the backup can be viewed in the OceanBase Dashboard (full support arrives with ob‑dashboard 0.4.0).

4. Summary

The procedure successfully performed a full backup of an OceanBase tenant on Kubernetes to Baidu Cloud BOS using S3‑compatible storage, confirming the backup via the OceanBase Dashboard.

Reference: OceanBase Operator User Guide – Tenant Backup

cloud-nativeKubernetesOperatorBackups3OceanBaseBOS
Xiaolei Talks DB
Written by

Xiaolei Talks DB

Sharing daily database operations insights, from distributed databases to cloud migration. Author: Dai Xiaolei, with 10+ years of DB ops and development experience. Your support is appreciated.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.