I'm going to start using Mongo as a database but I will not have it clustered at first. Can I use Mongo on a single machine, then later come back, cluster it and capitalize on the sharding? Or can I set it up for a cluster with only one machine until I have more to add to the cluster?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
You can do it either way.
There isn't much benefit to starting all of the overhead for sharding now, unless you simply want to try it out to see how it works. It is important to pick the correct shard key, so you would want to make sure your schema and insert/update usage is firm enough to know what to pick.
Kristina Chodorow has a great blog entry about how to pick a shard key: http://www.snailinaturtleneck.com/blog/2011/01/04/how-to-choose-a-shard-key-the-card-game/
For general information about how sharding works: http://www.snailinaturtleneck.com/blog/2010/03/30/sharding-with-the-fishes/
For some instructions on how to set up clustering on a single machine, see here: http://www.mongodb.org/display/DOCS/A+Sample+Configuration+Session and here: http://www.snailinaturtleneck.com/blog/2010/08/30/return-of-the-mongo-mailbag/
I'm currently using single-server MongoDBs and didn't reach the point where I need to add clustering. MongoDB is efficient enough for most projects. As far as I understand, MongoDB clustering is very easy and add/drop servers doesn't affect the cluster at all.