数据迁移工具概览
平凯数据库提供了丰富的数据迁移相关的工具,用于全量迁移、增量迁移、备份恢复、数据同步等多种场景。
本文介绍了使用这些工具的场景、支持的上下游、优势和相关限制等信息。请根据你的需求选择合适的工具。
TiDB Data Migration (DM)
| 使用场景 | 用于将数据从与 MySQL 协议兼容的数据库迁移到平凯数据库 |
|---|---|
| 上游 | MySQL,MariaDB,Aurora |
| 下游 | 平凯数据库 |
| 主要优势 | * 一体化的数据迁移任务管理工具,支持全量迁移和增量同步 * 支持对表与操作进行过滤 * 支持分库分表的合并迁移 |
| 使用限制 | 数据导入速度与 TiDB Lightning 的逻辑导入模式大致相同,而比 TiDB Lightning 的物理导入模式低很多。建议用于 1 TB 以内的存量数据迁移。 |
TiDB Lightning
| 使用场景 | 用于将数据全量导入到平凯数据库 |
|---|---|
| 上游(输入源文件) | * Dumpling 输出的文件 * 从 Amazon Aurora 或 Apache Hive 导出的 Parquet 文件 * CSV 文件 * 从本地盘或 Amazon S3 云盘读取数据 |
| 下游 | 平凯数据库 |
| 主要优势 | * 支持快速导入大量数据,实现快速初始化平凯数据库集群的指定表 * 支持断点续传 * 支持数据过滤 |
| 使用限制 | * 如果使用物理导入模式进行数据导入,TiDB Lightning 运行后,TiDB 集群将无法正常对外提供服务。 * 如果你不希望 TiDB 集群的对外服务受到影响,可以参考 TiDB Lightning 逻辑导入模式中的硬件需求与部署方式进行数据导入。 |
Dumpling
| 使用场景 | 用于将数据从 MySQL/TiDB 进行全量导出 |
|---|---|
| 上游 | MySQL,平凯数据库 |
| 下游(输出文件) | SQL,CSV |
| 主要优势 | * 支持全新的 table-filter,筛选数据更加方便 * 支持导出到 Amazon S3 云盘 |
| 使用限制 | * 如果导出后计划往非平凯数据库的数据库恢复,建议使用 Dumpling。 * 如果导出后计划往另一个平凯数据库恢复,建议使用 BR。 |
TiCDC
| 使用场景 | 通过拉取 TiKV 变更日志实现的 TiDB 增量数据同步工具,具有将数据还原到与上游任意 TSO 一致状态的能力,支持其他系统订阅数据变更 |
|---|---|
| 上游 | 平凯数据库 |
| 下游 | 平凯数据库,MySQL,Kafka,MQ,Confluent,存储服务(如 Amazon S3、GCS、Azure Blob Storage 和 NFS) |
| 主要优势 | 提供开放数据协议 (TiCDC Open Protocol)。 |
| 使用限制 | TiCDC 只能同步至少存在一个有效索引的表。暂不支持以下场景:
|
Backup & Restore (BR)
| 使用场景 | 通过对大数据量的 TiDB 集群进行数据备份和恢复,实现数据迁移 |
|---|---|
| 上游 | 平凯数据库 |
| 下游(输出文件) | SST,backup.meta 文件,backup.lock 文件 |
| 主要优势 |
|
| 使用限制 |
|
sync-diff-inspector
| 使用场景 | 用于校验 MySQL/平凯数据库 中两份数据的一致性 |
|---|---|
| 上游 | 平凯数据库,MySQL |
| 下游 | 平凯数据库,MySQL |
| 主要优势 | 提供了修复数据的功能,适用于修复少量不一致的数据。 |
| 使用限制 |
|
使用 TiUP 快速安装
TiUP 作为软件包管理器,可帮助你轻松管理平凯数据库生态系统中的不同集群组件。现在你可以只用一个 TiUP 命令行来管理任何组件。
第 1 步:安装 TiUP
curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh重新声明全局环境变量:
source ~/.bash_profile第 2 步:安装组件
你可以通过以下命令查看可用组件:
tiup list输出如下:
Available components:
Name Owner Description
---- ----- -----------
PCC community A tool used to capture plan changes among different versions of TiDB
bench pingcap Benchmark database with different workloads
br pingcap TiDB/TiKV cluster backup restore tool.
cdc pingcap CDC is a change data capture tool for TiDB
chaosd community An easy-to-use Chaos Engineering tool used to inject failures to a physical node
client pingcap Client to connect playground
cluster pingcap Deploy a TiDB cluster for production
ctl pingcap TiDB controller suite
dm pingcap Data Migration Platform manager
dmctl pingcap dmctl component of Data Migration Platform.
errdoc pingcap Document about TiDB errors
pd-recover pingcap PD Recover is a disaster recovery tool of PD, used to recover the PD cluster which cannot start or provide services normally.
playground pingcap Bootstrap a local TiDB cluster for fun
tidb pingcap TiDB is an open source distributed HTAP database compatible with the MySQL protocol.
tidb-dashboard pingcap TiDB Dashboard is a Web UI for monitoring, diagnosing, and managing the TiDB cluster
tidb-lightning pingcap TiDB Lightning is a tool used for fast full import of large amounts of data into a TiDB cluster
tikv-br pingcap TiKV cluster backup restore tool
tikv-cdc pingcap TiKV-CDC is a change data capture tool for TiKV
tiproxy pingcap TiProxy is a database proxy that is based on TiDB.
tiup pingcap TiUP is a command-line component management tool that can help to download and install TiDB platform components to the local system选择所需要的一个或多个组件进行安装。示例如下:
tiup install dmtiup install dm tidb-lightning注意
如果需要安装特定版本,可以使用
tiup install <component>[:version]命令.
第 3 步: 更新 TiUP 及组件 (可选)
建议先查看新版本的更新日志及兼容性说明:
tiup update --self && tiup update dm