Use of MongoDB database fragmentation and clustering
Sharded Cluster Data fragmentation in Mongodb is called chunk, which is a continuous data record in a Collection, but it has a size limit that cannot exceed 200M. If it exceeds, a new fragment will be generated. The following is a simple shard cluster example The composition of the shard cluster: Shard server: mongod instance, used to store actual data blocks Config server: mongod instance, used to store the entire Cluster Metadata, including chunk information. route server: mongos instance, as the front-end route of the entire cluster, from which the entire cluster is connected. This makes the entire cluster look like a single-process database. Remarks: route as a route will forward the request to the actual target service process, combine multiple results and send them back to the client. The route does not store any data and status, all information is from Config when starting server, when there is information update on the Config server, it will also be synchronized to the route server. the Build a simple cluster Cluster directory: There are four mongodb in total, the directories are /home/scotte.ye/mongo1, mongo2, mongo3, mongo4 Among them, mongo1 and mongo2 are used as shard servers mongo3 as config server mongo4 as…