TIDB的备份与恢复、上传OSS

一、备份

备份并上传到oss(注意br的版本要对应集群版本)

自行按需更改阿里云的信息access-key、secret-access-key、region、endpoint

1、整库备份

复制代码
tiup br:v7.5.0  backup full \
--pd "172.16.22.1:32579,172.16.22.2:32579,172.16.22.3:32579" \
--storage "s3://alltidb-backup/test/test_20241217?access-key=xxxxxxxx&secret-access-key=xxxxxxxx" \
--s3.provider "alibaba" \
--s3.region "oss-ap-southeast-1" \
--s3.endpoint "https://oss-ap-southeast-1-internal.aliyuncs.com"

2、单表备份

复制代码
tiup br:v7.5.1  backup table \
--pd "172.16.22.1:32579,172.16.22.2:32579,172.16.22.3:32579" \
--db "test" \
--table "test_table" \
--storage "s3://alltidb-backup/test/test-test_table_20241217?access-key=xxxxxxxx&secret-access-key=xxxxxxxx" \
--s3.provider "alibaba" \
--s3.region "oss-ap-southeast-1" \
--s3.endpoint "https://oss-ap-southeast-1-internal.aliyuncs.com"

二、查看

查看某个快照备份对应的快照物理时间点

复制代码
tiup br:v7.5.0 validate decode --field="end-version" \
--storage "s3://alltidb-backup/test/test_20241217?access-key=xxxxxxxx&secret-access-key=xxxxxxxx" \
--s3.provider "alibaba" \
--s3.region "oss-ap-southeast-1" \
--s3.endpoint "https://oss-ap-southeast-1-internal.aliyuncs.com" | tail -n1

三、恢复

1、恢复单个数据库的数据

复制代码
tiup br:v7.5.0 restore db \
--pd "172.16.22.1:32579,172.16.22.2:32579,172.16.22.3:32579" \
--db "test" \
--storage "s3://alltidb-backup/test/test_20241217?access-key=xxxxxxxx&secret-access-key=xxxxxxxx" \
--s3.provider "alibaba" \
--s3.region "oss-ap-southeast-1" \
--s3.endpoint "https://oss-ap-southeast-1-internal.aliyuncs.com"

2、恢复单张表的数据

复制代码
tiup br:v7.5.0 restore table \
--pd "172.16.22.1:32579,172.16.22.2:32579,172.16.22.3:32579" \
--db "test" \
--table "test_table" \
--storage "s3://alltidb-backup/test/test-test_table_20241217?access-key=xxxxxxxx&secret-access-key=xxxxxxxx" \
--s3.provider "alibaba" \
--s3.region "oss-ap-southeast-1" \
--s3.endpoint "https://oss-ap-southeast-1-internal.aliyuncs.com"

3、使用表库过滤功能恢复部分数据

复制代码
tiup br:v7.5.0 restore full \
--pd "172.16.22.1:32579,172.16.22.2:32579,172.16.22.3:32579" \
--filter 'db*.tbl*' \
--storage "s3://alltidb-backup/test/test_20241217?access-key=xxxxxxxx&secret-access-key=xxxxxxxx" \
--s3.provider "alibaba" \
--s3.region "oss-ap-southeast-1" \
--s3.endpoint "https://oss-ap-southeast-1-internal.aliyuncs.com"
相关推荐
惊讶的猫24 分钟前
Redis持久化介绍
数据库·redis·缓存
Apple_羊先森36 分钟前
ORACLE数据库巡检SQL脚本--19、磁盘读次数最高的前5条SQL语句
数据库·sql·oracle
全栈前端老曹1 小时前
【MongoDB】Node.js 集成 —— Mongoose ORM、Schema 设计、Model 操作
前端·javascript·数据库·mongodb·node.js·nosql·全栈
神梦流1 小时前
ops-math 算子库的扩展能力:高精度与复数运算的硬件映射策略
服务器·数据库
让学习成为一种生活方式2 小时前
trf v4.09.1 安装与使用--生信工具42-version2
数据库
啦啦啦_99992 小时前
Redis-5-doFormatAsync()方法
数据库·redis·c#
生产队队长2 小时前
Redis:Windows环境安装Redis,并将 Redis 进程注册为服务
数据库·redis·缓存
老邓计算机毕设2 小时前
SSM找学互助系统52568(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面
数据库·ssm 框架·javaweb 毕业设计
痴儿哈哈2 小时前
自动化机器学习(AutoML)库TPOT使用指南
jvm·数据库·python
Σίσυφος19002 小时前
PCL法向量估计 之 方向约束法向量(Orientation Guided Normal)
数据库