How to separate mongodb data files from the journal?

Where should I move the mongodb dump in production remote server?

  • I created a mongodb dump of database in my localmachine. It was put in dump folder as "myProject". Within myProject I had two files one ending with .bson and other with metadata.json. I moved the myProject folder to my remote server. I used mongorestore on myProject folder. I have installed mongodb in my remote server. I got error /dbpath (/data/db/) does not exist and  I fixed them using first solution given here. 1) Now how will mongodb in remote server know the location of my restored dump? 1a) Should I move the .json and .bson file to a new folder named same as the database name ("myProject" placed inside /data/db/)? 2) If I need to move the restored dump where should I move them? 3) Mine is a spring web app and I am running in tomcat sever. So far in my localmachine, the spring bean had the host value as "localhost". Should it be changed to my remote server Ip address, when I am running the application in remote server or Is it fine if the value is localhost?

  • Answer:

    you runned mongorestore on your remote server *before* installing mongodb itself? well. once your mongod is running, on your remote server, simply run mongorestore: mongorestore myProject it will deploy your dump inside your dbpath. no need to move your dump folder anywhere. since your mongodb is running, when you execute the mongorestore command, it will connect to your mongodb server and deploy your dump. if you check your /data/db dir contents, you will find database_name.* files there, where database_name are the name of the dumped dbs. you can also run, inside mongodb consoles, the command show dbs to assert your db is there.

Lucas Vieira at Quora Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.