"MongoDB" to build MongoDB Shard System under Window System (i)

Source: Internet
Author: User

This article mainly describes the main principles of the Shard cluster

Frankly, just see this shard system (sharding) a little bit, feeling a bit too big on the. See American writer Kyle Banker "Mongodb in action" is not clear. and query data, first of all to do a description of the Shard. From other books, say Shard This is a kind of database cluster system that expands the massive data level, the data table is stored on each node of sharding, and the user can easily configure a distributed MongoDB cluster by simple configuration.

I. Description of the roleto build a MongoDB shard cluster, you need three roles:

    • Shard server stores the actual data score slices, each shard can be a mongod instance, or a set of Mongod instances that make up the replica set (that is, the copy set described in the previous blog). In order to implement each shard internal Auto-failover,mongodb the official recommendation for each shard is a set of replica set.
    • Config Server in order to store a specific collection in multiple Shard, you need to specify a shard key for the collection, for example {Age:1},shard key determines which chunk the record belongs to. Config servers is used to store all shard node configuration information (chunk), Shard key range for each chunk, chunk distribution in each shard, Sharding configuration information for all DB and collection in the cluster
    • Route Process This one front-end route, the client then access, then ask config servers to which shard to query or save the record, in connection with the corresponding shard to operate, and finally return the results to the client. The client simply sends the query or update request that was originally sent to Mongod to Rounting Processl. Instead of worrying about which shard the records are stored on,
II. Framework Structure

If you are building a shard cluster with a physical machine: The structure diagram is as follows:


Ports are different for each server

Iii. Description of the framework

Because the Shard cluster is abstract, I see some notes from other data, and here is a supplement;

A: Sharding is the database on multiple servers

B: Query a user actually involves two queries, the first time to access the configuration database to obtain the user's Shard location, the second query directly access to the Shard containing user data

C: Main solution to the problem of scaling and load balancing

D: The well-known framework for manually managing shards is: Twitter's gizzard (see: HTTP://MNG.BZ/4QVD)

E: The partitioning determinants of the current system: Disk activity, System load, and the ratio of the most important working set size to available memory

F:chunk Block Concept: It is a contiguous shard key range that is located in a shard. They are logical things rather than physical meanings.

G: sharding key: MongoDB shards are range-based. This means that each document in the collection of shards must fall within a range of values for the specified key. The Sharding key is where each document can find its place in these scopes.

H: Split and migrate

These two are completely different concepts, splitting the idea is when the Shard block data reached a certain age to divide it into two pieces. The two blocks after splitting have the same number of documents. Splitting is only a logical operation and does not affect the physical order of the documents in the Shard collection.

Migration is managed by the software called the "balancer" equalizer, and its task is to ensure that the data remains evenly distributed across the nodes. This capability can be achieved by tracking the number of shard blocks. In general, when the number of shards in a cluster with the largest chunk of the block is greater than 8 o'clock, the equalizer has a balanced processing.

I: Suggested frame chart




"MongoDB" to build MongoDB Shard System under Window System (i)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.