Documentation Index Fetch the complete documentation index at: https://mintlify.com/pingcap/tidb/llms.txt
Use this file to discover all available pages before exploring further.
TiDB’s BR (Backup & Restore) tool performs distributed backups directly from TiKV nodes, making it fast even for large clusters. BR supports full and incremental backups, and point-in-time recovery (PITR).
Full backup
tiup br backup full \
--pd "127.0.0.1:2379" \
--storage "s3://my-bucket/backup-20240101" \
--s3.region "us-east-1" \
--log-file backup.log
Amazon S3
Google Cloud Storage
Azure Blob Storage
Local filesystem
tiup br backup full \
--pd "127.0.0.1:2379" \
--storage "s3://my-bucket/tidb-backup" \
--s3.region "us-east-1" \
--send-credentials-to-tikv=true
tiup br backup full \
--pd "127.0.0.1:2379" \
--storage "gcs://my-bucket/tidb-backup" \
--gcs.credentials-file "/path/to/credentials.json"
tiup br backup full \
--pd "127.0.0.1:2379" \
--storage "azure://my-container/tidb-backup" \
--azblob.account-name "myaccount" \
--azblob.account-key "mykey"
tiup br backup full \
--pd "127.0.0.1:2379" \
--storage "local:///data/backup"
Local storage only works if all TiKV nodes can write to the same path (e.g., a shared NFS mount). Not recommended for production.
Incremental backup
After a full backup, you can back up only the changes since the last backup using --lastbackupts.
# Get the timestamp from the last backup
LAST_TS = $( tiup br validate decode --field= "EndVersion" \
--storage "s3://my-bucket/tidb-backup-full" 2> /dev/null )
# Run incremental backup
tiup br backup full \
--pd "127.0.0.1:2379" \
--storage "s3://my-bucket/tidb-backup-incremental" \
--lastbackupts ${ LAST_TS }
Point-in-time recovery (PITR)
PITR lets you restore a cluster to any point in time within a log backup window.
Enable log backup
tiup br log start \
--task-name= "pitr-task" \
--pd "127.0.0.1:2379" \
--storage "s3://my-bucket/log-backup"
Take a full backup
tiup br backup full \
--pd "127.0.0.1:2379" \
--storage "s3://my-bucket/full-backup"
Restore to a point in time
tiup br restore point \
--pd "127.0.0.1:2379" \
--storage "s3://my-bucket/log-backup" \
--full-backup-storage "s3://my-bucket/full-backup" \
--restored-ts "2024-01-15 10:30:00+00:00"
Full restore
tiup br restore full \
--pd "127.0.0.1:2379" \
--storage "s3://my-bucket/tidb-backup" \
--log-file restore.log
Restore a single database or table:
# Restore one database
tiup br restore full \
--pd "127.0.0.1:2379" \
--storage "s3://my-bucket/tidb-backup" \
--filter "mydb.*"
# Restore one table
tiup br restore table \
--pd "127.0.0.1:2379" \
--storage "s3://my-bucket/tidb-backup" \
--db "mydb" --table "orders"
Best practices
Schedule regular backups Run full backups daily and incremental backups hourly for critical data. Use cron or your scheduler of choice.
Test restores Regularly restore backups to a test cluster to verify they work before you need them in an emergency.
Use cloud storage Store backups in S3, GCS, or Azure Blob — separate from your TiKV nodes — so a node failure doesn’t affect backup availability.
Monitor backup jobs Check BR exit codes and log files. A backup that silently fails provides no protection.