How to copy mongo db data to another server

Hi,

I would like to copy all “mongodb data” from my old server to my new one.

I could do this via corona sdk simulator, but I would like to do it via filezilla client, because it would be faster.

Do you know what is the path for mongodb database?

Thanks and have a nice day :slight_smile:

Use CopyDB command:

https://docs.mongodb.com/manual/reference/command/copydb/

thanks for the advise, but it not works for me. Because I have mongo db 2.6. on the old server and 3.0 on the new one.

The easiest way I found is to make a backup of your data with “mongodump” in the old server, after upload the files to your new server, and then use “mongorestore” to recover all data.

Hey, how do you issue mongo commands with filezilla?

I connect via ssh to my server, then I use mongo commands from terminal connected via ssh.

I do the backup with command “mongodump”:

sudo mongodump --db _objects --out /var/backups/mongo/

After I go to filezilla, and I download the backup to my computer, next I upload the backup to my new server, also with filezilla.

And then I run “mongorestore” from my new server via ssh terminal

sudo mongorestore --db _objects --drop /var/backups/mongo/_objects/

If you are using coronium take to account that you must upload files to lua folder, and after you must move them to the folder you want. Otherwise filezilla will not let you do it, and it will give you errors

Use CopyDB command:

https://docs.mongodb.com/manual/reference/command/copydb/

thanks for the advise, but it not works for me. Because I have mongo db 2.6. on the old server and 3.0 on the new one.

The easiest way I found is to make a backup of your data with “mongodump” in the old server, after upload the files to your new server, and then use “mongorestore” to recover all data.

Hey, how do you issue mongo commands with filezilla?

I connect via ssh to my server, then I use mongo commands from terminal connected via ssh.

I do the backup with command “mongodump”:

sudo mongodump --db _objects --out /var/backups/mongo/

After I go to filezilla, and I download the backup to my computer, next I upload the backup to my new server, also with filezilla.

And then I run “mongorestore” from my new server via ssh terminal

sudo mongorestore --db _objects --drop /var/backups/mongo/_objects/

If you are using coronium take to account that you must upload files to lua folder, and after you must move them to the folder you want. Otherwise filezilla will not let you do it, and it will give you errors