MongoDB in production

6

I have an application that uses MongoDB, I'm getting to the end of its development and I just started thinking about how the installation of this bank would be done in the production environment. During development the collections were being created as they were needed, but I never really stopped to think about how I would restore this in production.

How is this usually done? Should I just create empty collections and leave the application running? Or should I use mongodump ? If mongodump is the recommended way, how do I prevent it from backing up to documents and contain only the collections with its indexes >?

Thanks in advance.

    
asked by anonymous 29.08.2015 / 16:08

1 answer

1

This depends on what is stored in each collection. I usually identify the ones that represent data created by the users versus the data that is required for the application to run (type lists of countries and states). These last ones I call mandatory data and I create scripts to create and populate these collections (or even tables when using relational DB.)

You can also use mongodump to copy these required data but I find it important to have the script and a source of that data other than your development bank. Imagine if you depend on that bank to be able to create the production bank and it is a chance to corrupt the bank before you can copy.

User data typically does not make sense to be copied to production.

mongodump will also be useful when you are configuring the backups of your production bank (which I hope is something you plan to do as well).

    
04.09.2015 / 20:50