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遷移工具MongoshakeMongoDB
- 深度學習之遷移學習介紹與使用深度學習遷移學習
- 遷移sqlserver資料到MongoDbSQLServerMongoDB
- MongoDB shell 介紹MongoDB
- 高效能圖表LightningChart JS 遷移指南介紹GCJS
- win10如何使用自帶遷移工具 win10使用自帶遷移工具的方法Win10
- certutil工具的使用介紹
- 20202.9.29課堂筆記(Sqoop介紹及資料遷移)筆記OOP
- JEB工具的介紹及使用
- MongoDB mongoshake 遷移分片到複製集合MongoDB
- mydumper備份工具介紹與使用
- MongoDB 資料遷移 備份 匯入(自用)MongoDB
- mongodb資料遷移2種方式比較MongoDB
- 使用DynamoShake從dynamodb遷移到mongodbMongoDB
- Google guava工具類的介紹和使用GoGuava
- domutils 工具庫的使用方法介紹
- MongoDB Oplog中的欄位介紹MongoDB
- MongoDB三種聚合命令用法介紹MongoDB
- 介紹一個MongoDB的替代方案MongoDB
- MongoDB基本介紹與安裝(1)MongoDB
- etcdctl工具介紹
- Redis migrate 資料遷移工具Redis
- win10自帶系統遷移工具怎麼用 win10自帶系統遷移工具使用方法Win10
- 關於伺服器資料遷移,介紹在伺服器資料遷移計劃中的7個步驟伺服器
- github原始碼管理工具——使用介紹Github原始碼
- mytop 使用介紹 mysql實時監控工具MySql
- MySQL壓測工具mysqlslap的介紹與使用MySql
- MongoDB 資料庫介紹及安裝MongoDB資料庫
- uml建模工具介紹
- 資料遷移新技能,MongoDB輕鬆同步至ClickHouseMongoDB
- Dynamics CRM 資料遷移工具DataMigrationUtility
- EaseUS Todo PCTrans,資料遷移工具
- 在Sequelize中使用遷移
- Go 效能壓測工具之wrk介紹與使用Go
- MATLAB神經網路工具箱使用介紹Matlab神經網路
- percona 實用工具之pt-kill使用介紹
- Alibaba 資料庫遷移開源工具 Datax 安裝和使用資料庫開源工具
- 原型設計工具介紹原型
- MySQL 官方工具utilities介紹MySql