mongoDB遷移工具mongo-migrate使用介紹
功能
將一個叢集,複製集或者單機 mongoDB 中的一個集合的資料,遷移到另一個叢集,複製集或者單機 mongoDB. 如果源集合使用了分片,會在目標自動分片,並按照源集合的 chunk 進行 split 與隨機 movechunk. 如果源集合存在索引,會複製索引. 如果源使用了複製集,會使用 oplog 做增量遷移.
引數
--src "ip:host" 源地址 --srcDB "db name" 要遷移的資料庫名稱 --srcColl "collection name" 要遷移的集合名稱 --srcUserName "user name" 源 auth 使用者名稱 --srcPassWord "password" 源 auth 密碼 --dest "ip:host" 目標地址 --destDB "db name" 目標資料庫名稱 --destColl "collection name" 目標集合名稱 --destUserName "user name" 目標 auth 使用者名稱 --destPassWord "password" 目標 auth 密碼 --findAndInsertWorkerNum 10 複製資料時併發讀寫goroutine 數目
--writeAck 1 "same with w param in other driver" --writeMode "Majority" "see mongodb doc if needed" --journal true "whether use journal" --fsync false "whether wait for fsync for each write"
已知bug
- 複製索引時,文字索引不能正常建立
範圍遷移使用
範圍遷移為應對資料量較多時的方法,使用有許多限制,相關引數如下: --minKey 範圍最小值(包含) --maxKey 範圍最大值(不包含) --keyType "int or string" key 的型別,只支援數字與字串 這裡的範圍是進行 shardCollection 時第一個 key 的範圍 範圍遷移的一些行為:
- 如果目標 ns 已經分片,則不進行分片 以及 預分配操作.
- 如果指定了範圍為 int 型別的0 - 100 ,則所有非 int 型的資料不能被遷移.
- int 型包含 int64與 float64,對應於在 mongoDB 中直接寫入{ key:1 } 與 {key:NumberLong:1}
額外引數,-- withOutKeyType string 一般用來配合範圍遷移使用,使用場景: 有集合, shardkey 的第一個 key 99% 都為數字,先透過範圍遷移: 0-100,100-200...將99% 資料遷移. 再使用非範圍遷移,並指定 --withOutKeyType "int" 將剩餘部分資料遷移.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15498/viewspace-1966782/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 深度學習之遷移學習介紹與使用深度學習遷移學習
- MongoDB管理工具Rockmongo介紹MongoDB
- MongoDB常用工具集介紹MongoDB
- 行遷移_行連結的介紹
- MongoDB介紹MongoDB
- MongoDB自帶的監控工具介紹MongoDB
- MongoDB資料比較工具dbHash介紹MongoDB
- 遷移sqlserver資料到MongoDbSQLServerMongoDB
- MongoDB shell 介紹MongoDB
- MongoDB 資料遷移和同步MongoDB
- 【Mongodb】Sharding 手工遷移chunkMongoDB
- MongoDB遷移工具MongoshakeMongoDB
- 資料庫中跨平臺遷移方法介紹資料庫
- JEB工具的介紹及使用
- 【工具】Sublime使用詳細介紹
- mongodb常用語句介紹MongoDB
- MongoDB資料模型介紹MongoDB模型
- 移動web開發除錯工具AlloyLever介紹Web除錯
- 【遷移】使用rman遷移資料庫資料庫
- mydumper備份工具介紹與使用
- MongoDB啟動引數介紹MongoDB
- 高效能圖表LightningChart JS 遷移指南介紹GCJS
- Google guava工具類的介紹和使用GoGuava
- domutils 工具庫的使用方法介紹
- 官方壓測工具mysqlslap介紹及使用MySql
- mongodb資料遷移2種方式比較MongoDB
- MongoDB 資料遷移 備份 匯入(自用)MongoDB
- MongoDB mongoshake 遷移分片到複製集合MongoDB
- cpio工具介紹
- MongoDB基本介紹與安裝(1)MongoDB
- MongoDB三種聚合命令用法介紹MongoDB
- 介紹一個MongoDB的替代方案MongoDB
- MongoDB副本集管理方法介紹MongoDB
- node.js連線mongodb介紹Node.jsMongoDB
- MongoDB備份方式詳細介紹MongoDB
- MySQL壓測工具mysqlslap的介紹與使用MySql
- [原創]zabbix工具介紹,安裝及使用
- uml建模工具介紹