最近在搞数据库迁移,顺便汇总了一下各种数据库迁移的做法。其中最主要用到的是阿里云的DTS数据传输服务产品:一种将用户的MySQL、SQLServer、Redis、Mongodb从一个地方或账号迁移到另一个地方或账号的迁移工具(仅支持数据库的迁移)。
DTS官网链接是:https://www.aliyun.com/product/dts。
DTS支持的迁移形式有三种:
结构迁移:是指进行结构对象定义语法的迁移,包括表、视图、触发器、存储过程、存储函数、同义词等结构对象的语法迁移
全量迁移:将源实例数据库中的所有数据,不包括结构语法定义,迁移到目标实例。如果创建迁移任务时,只选择全量数据迁移,而不选增量数据迁移,那么在迁移过程中,如果源实例有数据写入,那么对于迁移过程中源实例的新增数据,不会迁移到目标实例。
增量迁移:将源实例写入的增量数据同步到目标实例。如果创建迁移任务时,选择了全量数据迁移及增量数据迁移,那么数据传输服务会先在源实例实现静态快照,先将快照数据迁移到目标实例之后,再将迁移过程中源实例写入的增量数据同步到目标实例中。增量数据迁移是一个保持目标实例跟源实例数据实时同步的过程,不会自动结束,如果需要结束迁移,那么需要在控制台手动结束任务。
迁移之前需要在阿里云上购买目标数据库,建议先开通按量的,迁移完成数据无误后再转成包年包月。
一、 用DTS迁移到RDS For MySQL
- 从AWS云迁移到阿里云
https://help.aliyun.com/document_detail/52555.html - 从腾讯云迁移到阿里云
https://help.aliyun.com/document_detail/52904.html - 从本地MySQL迁移到RDS for MySQL(必选:结构迁移、全量迁移,可选:增量迁移)
https://help.aliyun.com/document_detail/26621.html - RDS实例间的数据迁移(可跨账号)
https://help.aliyun.com/document_detail/26626.html - 使用DTS跨阿里云账号迁移RDS数据(和第4点类似)
https://help.aliyun.com/document_detail/26652.html - 跨阿里云账号的ECS自建数据库迁移至RDS(和第4点类似)
https://help.aliyun.com/document_detail/26653.html - ECS上的自建MySQL迁移至POLARDB实例
https://help.aliyun.com/document_detail/100167.html - 将RDS MySQL迁移至POLARDB
https://help.aliyun.com/document_detail/100169.html
小技巧
迁移完成后将在程序中用新RDS地址替换老的RDS地址,可以修改链接地址为自己想要的,避免再修改程序中数据库地址。具体操作见:https://help.aliyun.com/document_detail/96941.html
二、用DTS迁移RDS For SQL Server
- 从本地 SQL Server 迁移到 RDS for SQL Server
https://help.aliyun.com/document_detail/26622.html - SQL Server 不停机迁移
https://help.aliyun.com/document_detail/34357.html
三、用DTS迁移到阿里云Redis
- ECS上的自建数据库到Redis的数据迁移
https://help.aliyun.com/document_detail/26627.html - 自建 Redis 实例到阿里云 Redis 实例的迁移
https://help.aliyun.com/document_detail/47896.html - 将AWS ElastiCache for Redis数据库迁移到阿里云
https://help.aliyun.com/document_detail/101071.html - 将Google Cloud Platform Memorystore数据库迁移到阿里云Redis
https://help.aliyun.com/document_detail/108871.html - 将SSDB数据库迁移到云数据库Redis版
https://help.aliyun.com/document_detail/102928.html -
云下到云上的迁移
- Redis集群迁移
https://help.aliyun.com/document_detail/85180.html - Codis集群迁移
https://help.aliyun.com/document_detail/97655.html - 使用redis-port进行迁移
https://help.aliyun.com/document_detail/66006.html - 使用redis-shake进行迁移
https://help.aliyun.com/document_detail/111066.html - 使用RDB文件进行迁移
https://help.aliyun.com/document_detail/66008.html - 使用AOF文件进行迁移
https://help.aliyun.com/document_detail/26357.html - 使用redis-shake迁移RDB文件内的数据
https://help.aliyun.com/document_detail/116378.html
- Redis集群迁移
-
云数据库Redis版之间迁移
- 使用rump在云数据库Redis版之间迁移
https://help.aliyun.com/document_detail/94129.html - 全球多活进行跨地域实例迁移
https://help.aliyun.com/document_detail/97729.html - 使用redis-port跨账号迁移
https://help.aliyun.com/document_detail/92477.html - 全球多活进行跨VPC实例迁移
https://help.aliyun.com/document_detail/100193.html
- 使用rump在云数据库Redis版之间迁移
- 更多Reids迁移方案
https://help.aliyun.com/document_detail/97027.html
四、用DTS迁移到阿里云MongoDB
- ECS上的自建数据库到MongoDB的数据迁移
https://help.aliyun.com/document_detail/26627.html - 本地MongoDB数据库迁移至云数据库MongoDB
https://help.aliyun.com/document_detail/26625.html - MongoDB副本集实例迁移至分片集群实例(源实例数据库版本需为3.2或3.4版本,暂不支持4.0版本)
https://help.aliyun.com/document_detail/113516.html - DTS将腾讯云MongoDB数据库迁移至阿里云
https://help.aliyun.com/document_detail/101442.html -
MongoDB更多迁移方法
- 腾讯云MongoDB数据库迁移至阿里云
https://help.aliyun.com/document_detail/101445.html - 华为云文档数据库迁移至阿里云
https://help.aliyun.com/document_detail/101825.html - Atlas MongoDB数据库迁移至阿里云
https://help.aliyun.com/document_detail/102305.html - Amazon DynamoDB数据库迁移至阿里云
https://help.aliyun.com/document_detail/115570.html - MongoDB数据迁移方案概览
https://help.aliyun.com/document_detail/99995.html
- 腾讯云MongoDB数据库迁移至阿里云