Table of Contents
一、角色说明
二、框架结构
三、框架说明
Home Database Mysql Tutorial 【MongoDB】在window系统下搭建MongoDB的分片系统(一)

【MongoDB】在window系统下搭建MongoDB的分片系统(一)

Jun 07, 2016 pm 04:09 PM
mongodb window main Fragmentation build system

这篇主要讲述分片集群的主要原理 坦白说,刚看到这个分片系统(Sharding)有点蒙,感觉有点太高大上了。看美国作家Kyle Banker《Mongodb in action》没有明白。又查询资料,首先对与分片的做个说明。从其他书本上看的,说分片这是一种将海量数据水平扩展的数

这篇主要讲述分片集群的主要原理

坦白说,刚看到这个分片系统(Sharding)有点蒙,感觉有点太高大上了。看美国作家Kyle Banker《Mongodb in action》没有明白。又查询资料,首先对与分片的做个说明。从其他书本上看的,说分片这是一种将海量数据水平扩展的数据库集群系统,数据分表存储在sharding的各个节点上,使用者通过简单的配置就可以很方便地够将一个分布式MongoDB集群。

一、角色说明

要构建一个MongoDB分片集群,需要三个角色:

shard server 即存储实际数据得分片,每个shard 可以是一个Mongod实例,也可以是一组mongod实例构成得Replica Set(也就是以前博客里说明的复制集)。为了实现每个shard内部的auto-failover,MongoDB官方建议每个shard 为一组Replica set。Config Server 为了将一个特定的collection存储在多个shard中,需要为该collection指定一个shard key,例如{age:1},shard key可以决定该条记录属于哪个chunk。(chunk将在后面做详细介绍)Config Servers就是用来存储所有shard节点的配置信息,每个chunk的shard key范围,chunk在各shard的分布情况 、该集群中所有DB和collection的sharding 配置信息Route Process 这个一个前端路由,客户端由此接入,然后询问config servers需要到哪个shard上查询或把保存记录,在连接相应的shard进行操作,最后讲结果返回客户端。客户端只需要将原本发给mongod的查询或更新请求原封不动地发给rounting processl.而不必关心所操作的记录存储在哪个shard上,

二、框架结构

如果用一台物理机搭建分片集群:结构图如下:

\

每个服务器的端口不一样

三、框架说明

由于该分片集群比较抽象,我从其他数据上看到些说明,在这里做一个补充;

A:分片是把数据库分别在多个服务器上

B:查询一个用户实际涉及两次查询,第一次访问配置数据库以获得用用户的分片位置,第二次查询直接访问包含用户数据的分片

C:主要解决说明扩容问题以及负载均衡问题

D:手动管理分片的著名框架为: Twitter的Gizzard (详见:http://mng.bz/4qvd)

E :对现在系统的分片决定因素: 磁盘活动,系统负载以及最重要的工作集大小与可用内存的比例

F:chunk块的概念:它是位于一个分片中的一段连续的分片键范围。它们是种逻辑意义上的东西而不是物理意义上的。

G: 分片键: MongoDB的分片是基于范围的。也就是说分片的集合中每个文档都必须落在指定键的某个值范围。分片键就是让每个文档能在这些范围中找到自己的位置

H:拆分和迁移

这两个是完全不同的概念,拆分思想是当分片块数据达到一定大小时候把其分为两块。拆分后的两块都有相同数量的文档。拆分仅仅是个逻辑操作,不会影响分片集合中里文档的物理顺序。

迁移是由名为“balancer”均衡器软件进行管理的,它的任务是确保数据在各个节点中保持均匀分布。通过跟踪各分片块的数量,就能实现该功能。通常来说,当集群中拥有块最多的分片与拥有块最少的分片的块数差大于8时,均衡器就会发生一次均衡处理。

I:建议框架图

\

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

CUDA's universal matrix multiplication: from entry to proficiency! CUDA's universal matrix multiplication: from entry to proficiency! Mar 25, 2024 pm 12:30 PM

General Matrix Multiplication (GEMM) is a vital part of many applications and algorithms, and is also one of the important indicators for evaluating computer hardware performance. In-depth research and optimization of the implementation of GEMM can help us better understand high-performance computing and the relationship between software and hardware systems. In computer science, effective optimization of GEMM can increase computing speed and save resources, which is crucial to improving the overall performance of a computer system. An in-depth understanding of the working principle and optimization method of GEMM will help us better utilize the potential of modern computing hardware and provide more efficient solutions for various complex computing tasks. By optimizing the performance of GEMM

Huawei's Qiankun ADS3.0 intelligent driving system will be launched in August and will be launched on Xiangjie S9 for the first time Huawei's Qiankun ADS3.0 intelligent driving system will be launched in August and will be launched on Xiangjie S9 for the first time Jul 30, 2024 pm 02:17 PM

On July 29, at the roll-off ceremony of AITO Wenjie's 400,000th new car, Yu Chengdong, Huawei's Managing Director, Chairman of Terminal BG, and Chairman of Smart Car Solutions BU, attended and delivered a speech and announced that Wenjie series models will be launched this year In August, Huawei Qiankun ADS 3.0 version was launched, and it is planned to successively push upgrades from August to September. The Xiangjie S9, which will be released on August 6, will debut Huawei’s ADS3.0 intelligent driving system. With the assistance of lidar, Huawei Qiankun ADS3.0 version will greatly improve its intelligent driving capabilities, have end-to-end integrated capabilities, and adopt a new end-to-end architecture of GOD (general obstacle identification)/PDP (predictive decision-making and control) , providing the NCA function of smart driving from parking space to parking space, and upgrading CAS3.0

Which version is generally used for mongodb? Which version is generally used for mongodb? Apr 07, 2024 pm 05:48 PM

It is recommended to use the latest version of MongoDB (currently 5.0) as it provides the latest features and improvements. When selecting a version, you need to consider functional requirements, compatibility, stability, and community support. For example, the latest version has features such as transactions and aggregation pipeline optimization. Make sure the version is compatible with the application. For production environments, choose the long-term support version. The latest version has more active community support.

The difference between nodejs and vuejs The difference between nodejs and vuejs Apr 21, 2024 am 04:17 AM

Node.js is a server-side JavaScript runtime, while Vue.js is a client-side JavaScript framework for creating interactive user interfaces. Node.js is used for server-side development, such as back-end service API development and data processing, while Vue.js is used for client-side development, such as single-page applications and responsive user interfaces.

Always new! Huawei Mate60 series upgrades to HarmonyOS 4.2: AI cloud enhancement, Xiaoyi Dialect is so easy to use Always new! Huawei Mate60 series upgrades to HarmonyOS 4.2: AI cloud enhancement, Xiaoyi Dialect is so easy to use Jun 02, 2024 pm 02:58 PM

On April 11, Huawei officially announced the HarmonyOS 4.2 100-machine upgrade plan for the first time. This time, more than 180 devices will participate in the upgrade, covering mobile phones, tablets, watches, headphones, smart screens and other devices. In the past month, with the steady progress of the HarmonyOS4.2 100-machine upgrade plan, many popular models including Huawei Pocket2, Huawei MateX5 series, nova12 series, Huawei Pura series, etc. have also started to upgrade and adapt, which means that there will be More Huawei model users can enjoy the common and often new experience brought by HarmonyOS. Judging from user feedback, the experience of Huawei Mate60 series models has improved in all aspects after upgrading HarmonyOS4.2. Especially Huawei M

Where is the database created by mongodb? Where is the database created by mongodb? Apr 07, 2024 pm 05:39 PM

The data of the MongoDB database is stored in the specified data directory, which can be located in the local file system, network file system or cloud storage. The specific location is as follows: Local file system: The default path is Linux/macOS:/data/db, Windows: C:\data\db. Network file system: The path depends on the file system. Cloud Storage: The path is determined by the cloud storage provider.

What are the advantages of mongodb database What are the advantages of mongodb database Apr 07, 2024 pm 05:21 PM

The MongoDB database is known for its flexibility, scalability, and high performance. Its advantages include: a document data model that allows data to be stored in a flexible and unstructured way. Horizontal scalability to multiple servers via sharding. Query flexibility, supporting complex queries and aggregation operations. Data replication and fault tolerance ensure data redundancy and high availability. JSON support for easy integration with front-end applications. High performance for fast response even when processing large amounts of data. Open source, customizable and free to use.

Differences and similarities of cmd commands in Linux and Windows systems Differences and similarities of cmd commands in Linux and Windows systems Mar 15, 2024 am 08:12 AM

Linux and Windows are two common operating systems, representing the open source Linux system and the commercial Windows system respectively. In both operating systems, there is a command line interface for users to interact with the operating system. In Linux systems, users use the Shell command line, while in Windows systems, users use the cmd command line. The Shell command line in Linux system is a very powerful tool that can complete almost all system management tasks.

See all articles