KubeBlocks
BlogsKubeBlocks Cloud
⌘K
​

Overview

Introduction
Concepts
Kubernetes and Operator 101
Supported addons
About this manual

Try out KubeBlocks with Playground

Try out KubeBlocks on cloud
Try out KubeBlocks on laptop

Installation

Prerequisite for Local Env

Prerequisite for Local Env
Install kbcli
Install KubeBlocks
Install Addons
Uninstall KubeBlocks and kbcli

Upgrade KubeBlocks

Upgrade to v0.8
Upgrade to v0.9.0
Upgrade to v0.9.3
FAQ

Connect Database

Overview
Testing environment
Production environment

Maintenance

Scale

Horizontal Scale
Vertical Scale

Backup and Restore

Introduction

Backup

Configure BackupRepo
Configure BackupPolicy
Scheduled backup
On-demand backup

Restore

Restore from backup set
PITR

In Place Update

Overview on in-place update
Enable in-place update

Resource Scheduling

Configure pod affinity for database clusters

Cross K8s Deployment

Deploy a Cluster across Multiple Kubernetes Clusters by KubeBlocks

Instance Template

Introduction of instance template
Apply instance template

Observability

Monitor database
Configure alert

User Management

Manage user accounts

Handle an Exception

Handle an exception
Full disk lock

Developer

Developer guides
Terminology

Add an add-on to KubeBlocks

Add-ons of KubeBlocks
Add an add-on
Backup and restore
Parameter template
Parameter configuration
Monitoring
Multi-component configuration
Environment variables and placeholders

External Component

Reference external component

API Reference

Cluster
Backup
Add-On
  1. What is PITR (Point-in-Time Recovery)?
  2. How to perform PITR?

PITR

What is PITR (Point-in-Time Recovery)?

PITR (Point-in-Time Recovery) is a database backup and recovery technique commonly used in Relational Database Management Systems (RDBMS). It allows for the recovery of data changes to a specific point in time, restoring the database to a state prior to that point. In PITR, the database system regularly creates full backups and logs all transactions thereafter, including insert, update, and delete operations. During recovery, the system first restores the most recent full backup, and then applies the transaction logs recorded after the backup, bringing the database back to the desired state.

KubeBlocks supports PITR for databases such as MySQL and PostgreSQL. This documentation takes PostgreSQL PITR as an example.

How to perform PITR?

  1. View the timestamps to which the cluster can be restored.

    # 1. Get all backup objects for the current cluster kubectl get backup -l app.kubernetes.io/instance=pg-cluster # 2. Get the backup time range for Continuous Backup kubectl get backup -l app.kubernetes.io/instance=pg-cluster -l dataprotection.kubeblocks.io/backup-type=Continuous -oyaml ... status: timeRange: end: "2024-05-07T10:47:14Z" start: "2024-05-07T10:07:45Z"

    It can be seen that the current backup time range is 2024-05-07T10:07:45Z ~2024-05-07T10:47:14Z. Still, a full backup is required for data restoration, and this full backup must be completed within the time range of the log backups.

    kbcli cluster describe pg-cluster > ... Data Protection: BACKUP-REPO AUTO-BACKUP BACKUP-SCHEDULE BACKUP-METHOD BACKUP-RETENTION RECOVERABLE-TIME minio Enabled */5 * * * * archive-wal 8d May 07,2024 15:29:46 UTC+0800 ~ May 07,2024 15:48:47 UTC+0800

    RECOVERABLE-TIME represents the time range within which the cluster can be restored.

    It can be seen that the current backup time range is May 07,2024 15:29:46 UTC+0800 ~ May 07,2024 15:48:47 UTC+0800. Still, a full backup is required for data restoration, and this full backup must be completed within the time range of the log backups.

  2. Restore the cluster to a specific point in time.

    apiVersion: apps.kubeblocks.io/v1alpha1 kind: OpsRequest metadata: name: pg-cluster-pitr spec: clusterName: pg-cluster-pitr restore: backupName: 818aa0e0-pg-kubeblocks-cloud-n-archive-wal restorePointInTime: "2024-05-07T10:07:45Z" volumeRestorePolicy: Parallel type: Restore
    kbcli cluster restore pg-cluster-pitr --restore-to-time 'May 07,2024 15:48:47 UTC+0800' --backup <continuousBackupName>
  3. Check the status of the new cluster.

    kubectl get cluster pg-cluster-pitr
    kbcli cluster list pg-cluster-pitr

    Once the status turns to Running, it indicates a successful operation.

© 2025 ApeCloud PTE. Ltd.