Database export
-
Hi, I have a database on MONGODB, and I would like to remove it for transfer to another server, I read the NODENN documents and did not understand, can anyone help me here? What is the command? Where does it run?
-
@לוי-חביב
Presuming you are jacked into the command line on the server hosting your mongodb, it should be something like this:
mongodump --out /var/backups/mongo/$(date +%F)
I say "something like" because the simple form above would represent a poorly secured mongodb. Hence, you will most likely need a few additional flags:
mongodump -u "YourDbAdminUser" -p "SomePassPhrase" --out /var/backups/mongo/$(date +%F) --authenticationDatabase=admin
Upon successful completion that command will create a directory structure under /var/backups/mongo containing a full backup of your mongo database(s). You will then need to mongorestore this to your new server.
Mind you, the above only gets the database. You will likely also want the public file uploads and such. I suggest you review the NodeBB Upgrade Docs for further clarification.
Good luck!
-
You can copy the entire database if the database is used only for nodebb
mongodump -o /mydir/
mongorestore /mydir/
when transferring a database to another server, you need to copy the database dump and run the command
mongorestore /mydir/
The user and all the data will be automatically transferred