Starting mongo as a standalone single instance is straight forward. But on production environments, mongo db is always running in clustered format.

So how to replicate the same clustered format mongo db on your local machine or on staging instances or for testing purposes becomes critical.

The steps include:

  1. Download the mongo binary (Mongo installation)
  2. Create data directories for different nodes of the cluster
  3. Start mongo nodes pointing to different ports (as we are running all node on one machine)
  4. Initiate replica set
  5. Ready to use

#mongo #distributed-systems #cluster #replication #database

Start Mongo DB Cluster on localhost
1.25 GEEK