From MongoDB
Copy a MongoDB database to TeselaDB with mongodump and mongorestore.
Copy a MongoDB database to TeselaDB with mongodump and mongorestore, the MongoDB database tools.
Requirements
- A running TeselaDB cluster and its CA,
pki/ca.pem. - A user with the
restorerole in TeselaDB. - The MongoDB Database Tools on a machine that sees both.
Export from MongoDB
Shell
mongodump --uri "mongodb://user:<password>@mongo-01:27017/shop" --gzip --archive=shop.gzTo avoid stopping writes, export the whole replica set with --oplog, which also saves the operations that arrive
while the copy runs so that mongorestore applies them at the end.
Import into TeselaDB
Shell
mongorestore --uri "mongodb://root:<password>@node-01:27017/?tls=true&tlsCAFile=./ca.pem" --gzip --archive=shop.gzWith an archive made with --oplog, add --oplogReplay. mongorestore also creates the indexes.
Check
The counts and indexes of each collection match MongoDB's, as in Verify the migrated data.
Common problems
mongorestorefails withUnauthorized(13) because the user lacks therestorerole.- The connection to TeselaDB closes because
tls=trueis missing from the string.
See also
- Migrate from MongoDB, the step-by-step guide.
- From MongoDB Atlas