Things to Do Before Going Into Production With MongoDB
This article has some helpful tips for MongoDB users to keep in mind when gearing up for production.
Join the DZone community and get the full member experience.Join For Free
When using MongoDB in production, there are a number of recommendations to consider that can be quite helpful with issues such as performance, availability, and security. Some of the key considerations for using MongoDB in a production environment are outlined in this checklist.
Use 64-bit Builds
While MongoDB provides a 32-bit build, it is intended for development machines since there is a storage limitation of 2GB in the 32-bit version (the 64-bit version uses memory mapped files to allow more storage).
Updates to One or More Documents
MongoDB only updates one document by default, but if you want to be able to update multiple documents that match your query, then you will need to set the multi-parameter to a value of true. For example, MongoDB provides the following example that can be used to do this in the mongo shell:
Simply change bool_multi to a value of true to allow updating of multiple documents.
Make Sure Journaling Is Enabled
To maintain the durability of write operations, it is recommended to keep journaling enabled. This allows MongoDB to write change operations to the journal before changes are applied to the data files. This allows everything in the journal to be recovered if MongoDB were to encounter an unexpected stoppage, which ensure the data remains in a consistent state.
BSON Document Size
The size of a BSON document in MongoDB is limited to 16 megabytes. If you determine that you will need documents of a larger size, then the MongoDB team recommends you use GridFS, which uses chunking behind the scenes so that you can use larger documents.
If you are using a RAID array for your disks, it is recommended that you use a RAID-10 implementation, as other types of RAID arrays often lack either in performance or availability in comparison. For example, using RAID-5 or RAID-6 will not provide you with the performance you will need for MongoDB.
Networking and Security
It is strongly recommended that a production implementation of MogoDB be run only in an environment that can be trusted. First, the network in which it runs should disallow access from any unknown networks, systems, or machines. This can be best ensured by allowing access only to the systems that you absolutely know require it, such as your monitoring services or your application servers.
Once you have your MongoDB implementation set up for production, you will want reliable and stable database hosting. Morpheus Virtual Appliance is a tool that allows you manage heterogeneous databases in a single dashboard. With Morpheus, you have support for SQL, NoSQL, and in-memory databases like Redis across public, private, and hybrid clouds. So, visit the Morpheus site for pricing information or to schedule your demo today!
Published at DZone with permission of Darren Perucci, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.