Search code examples
mongodbkubernetesproductionreplicaset

Standalone MongoDB installation for Production


I want to deploy MongoDB to Kubernetes cluster with 2 nodes, there is no chance to add another node in the future.

I want to deploy MongoDB as standalone because both node will be able to access to same disk space via NFS and I don't have requirements for replication or high availability. However, in the MongoDB docs, it is clearly stated that standalone deployment is not suitable for production environment.

MongoDB Deploy Standalone

You can deploy a standalone MongoDB instance for Cloud Manager to manage. Use standalone instances for testing and development. Do not use these deployments for production systems as they lack replication and high availability.

What kind of drawbacks I can face? Should I deploy as replica set with arbiter instance? If yes, why?


Solution

  • Of course you can deploy a Standalone MongoDB for production. But if this node fails, then your application is not available anymore. If you don't have any requirement for availability then go for a Standalone MongoDB.

    However, running 2 MongoDB services which access the same physical disk (i.e. dbPath) will not work. Each MongoDB instance need to have a dedicated data folder.

    In your case, I would suggest a Replica Set. All data from one node will be replicated to the other one. If one node fails then the application goes into "read/only" mode.

    You can deploy an arbiter instance on the primary node. If the secondary node goes down, then the application is still fully available.