最近在搞數據庫遷移,順便彙總了一下各種數據庫遷移的做法。其中最主要用到的是阿里雲的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數據庫遷移至阿里雲