Approach to horizontal scaling - break up a collection onto multiple logical hosts
Want to spread data around to different databases
Split data up from a particular collection
Each shard is a replica set (at least 3 each)
Queries are distributed
Router - mongos - used to distribute the queries to the proper host. You can have multiple mongos instances. The mongos instances are similar to a replica set. They are stateless, and if one goes down, another takes over.
range-based approach
Shard Key
Queries are sent to the mongos router from the application
If query does not include the shard key, mongos will send to all shards to figure out location
Inserts require the shard key
data without a shard key will be stored in S0 (left-most shard database)
0 comments:
Post a Comment