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"
相关推荐
凌虚6 小时前
面向 MySQL 用户的 PostgreSQL 快速上手指南
数据库·后端·架构
五阿哥永琪6 小时前
MySQL中操作json的函数!
数据库·mysql·json
来者皆善7 小时前
了解Mysql优化吗?如何优化索引?
数据库·mysql
赤壁小虾9 小时前
【渲染流水线】[逐片元阶段]-[透明度测试]以UnityURP为例
java·前端·数据库
MC皮蛋侠客9 小时前
SQLAlchemy 系列(七):高级建模与高效写入——批量 DML、方言与扩展
数据库·python
奈斯先生Vector10 小时前
把 Midjourney 二次编辑做成生产系统:customId 能力令牌、Action Graph 与 WebUI 精修工作台
数据库·人工智能·架构·aigc·音视频·midjourney
Lethehong11 小时前
双擎并驱·全链路并行:KFS让TB级异构增量同步秒级到达
数据库
MC皮蛋侠客11 小时前
SQLAlchemy 系列(八):AsyncIO、并发与 Web 生命周期——让每个并发任务持有自己的 Session
数据库·python
一水11 小时前
Redis实战:一个AI工作流系统里的五个应用场景,从传参到限流的完整链路
数据库·redis·wpf
枫叶v.12 小时前
Prompt Injection 防不住怎么办?从 Source-Sink 模型设计 Agent 安全边界
数据库·安全·prompt