Site icon Shaharia's Blog

mongodump usage for MongoDB backup and restore

According to MongoDB Backup manual, mongodump is a very handy tools for MongoDB administrator to backup and restore full mongodb cluster or single database or single collection.

mongodump usage

Here is a very simple command to take backup or restore mongodb system.

Backup


sudo mongodump --host hostName -d databaseName --port portNumber --username userName --password passWord --out directoryLocation

with the above command you can take backup of your database. I don’t need to explain all parameters as I wrote variable name very clearly.

Restore

 sudo mongorestore --host hostName -d databaseName --port portNumber --username userName --password passWord backupSourceLocation 

I guess it will help you quickly.

Exit mobile version