We have to migrate data from dev to Prod( Sharded Environment).
We will use mongoDump and mongoRestore utility.
Take dump from Dev Server as:
We will use mongoDump and mongoRestore utility.
MongoDump: Used to create binary export of the contents of the database. It does not include index data. It requires to rebuild index after restoring the data.
Futher Reference from MongoDBMongoRestore: Used to import binary content from dump to the MongoDB instance.
Further Reference from MongoDBTake dump from Dev Server as:
mongodump --host dev_hostname:port -u user -p ****** --authenticationDatabase db_name_where_authentication_checks --db dbname --collection collection_name
A dump folder created includes bson file.
SCP that file to the Production server
Then restore as:
mongorestore --host
prod_hostname:port -u user -p ****** --authenticationDatabase db_name_where_authentication_checks --collection collection_name --db dbname path_to_dump_bson
Comments
Post a Comment