Search code examples
mongodbsharding

Sharding In MongoDB without Replication


I want to deploy sharding in mongodb. And I have only 3 Ubuntu servers. Is it possible with 3 servers (1 for config and 2 for sharding)?


Solution

  • Let me cite what you can find here.

    Sharding is the only solution for some classes of deployments. Use sharded clusters if:

    • your data set approaches or exceeds the storage capacity of a single MongoDB instance.
    • the size of your system’s active working set will soon exceed the capacity of your system’s maximum RAM.
    • a single MongoDB instance cannot meet the demands of your write operations, and all other approaches have not reduced contention.

    If these attributes are not present in your system, sharding will only add complexity to your system without adding much benefit.


    If you want to use sharding for learning or testing purposes then you could go with the minimal sharded clusters cluster.

    You'll need

    • one config server
    • one router (mongos instance)
    • 1 or more shards

    So in your case it is not easy to do, since you want to have 2 shards. So you would need 4 servers.

    However, maybe you can try to put the config and the router on the same machine.