One of the great things about MongoDB, and of course one of the key points in handling ‘Big Data’, is its handling of replication and sharding.
It is not within the scope of this particular post to describe the above concepts (follow the links!), although remember that replication is concerned with data security and sharding is concerned with data scaling.
It stands to reason that a combination of the two is required in order to have both security and scaling.
To get a sample environment up and running quickly, I have created a GitHub repository which brings up a simple sharded replica set example. It has two replica sets, each with three ‘mongod’ servers, and the required configuration and ‘mongos’ servers. It puts an appropriate amount of test data in to show the sharding in effect. It is easy to get up and running on a single machine, or VM if you prefer.
GitHub repository (includes documentation): sharded_replica_sets.
Enjoy, and please let me know if you have any comments.