Home Database Mysql Tutorial 【MongoDB】在windows平台下mongodb的分片集群(六)

【MongoDB】在windows平台下mongodb的分片集群(六)

Jun 07, 2016 pm 04:10 PM
mongodb windows Fragmentation

在本篇博客中我们主要讨论下博客的管理。由于已经在前面五篇中写了详细的实例,因此这里就不再举例说明。 一、监控 分片集群是整个体系中比较复杂的一块,因此更应该需要监控。 主要命令: serverstatus和currentOp() 二、手动分区 手动分区意思就是手动对线

在本篇博客中我们主要讨论下博客的管理。由于已经在前面五篇中写了详细的实例,因此这里就不再举例说明。

一、监控

分片集群是整个体系中比较复杂的一块,因此更应该需要监控。

主要命令: serverstatus和currentOp()

二、手动分区

手动分区意思就是手动对线上分片集群的块进行拆分和迁移。一般而言,一个分片写的越多,它越大。 movechunk命令在这种情况下同样有帮助

三、增加一个分片

sh.addShard("computername:port")

使用这种方式增加容量,要注意向新分片迁移数据所花费的时间。预计迁移速度是每分钟100~200M。最好在索引和工作集达到现有计划添加新分片。

四、删除分片

在一些很少见的情况下,你可能想删除一个分片,可以通过命令removeshard命令进行删除。一旦分片被清空,你还要确认将要删除的分片不是数据库的主分片,可以通过命令config.databases集合进行查询;

db.databases.find()

五、集合去分片

虽然可以删除一个分片,但是没有正式的路径去掉集合的分片。做法就是先用mongodump命令导出数据然后再用mongorestore来恢复数据。

六、备份分片集合

要备份分片集群,就是需要配置数据以及每个分片数据的副本;一种方式是利用monodump命令来导出数据。另一方式就是从每个分片的一个成员里复制数据文件,再从另一台服务器中复制数据文件。

无论那种方式,要确认再备份系统的时候没有块处在移动过程中。

停止均衡器:use config; db.setting.update({_id:"balancer"},{$set:{stopped:true},true})

备份之前重新确认: use config, db.locks.find({"_id":"balancer"})

备份之后别忘了启动均衡器

sh.setBalancerState()

sh.isBalancerRunning()

七、故障转移和恢复

分片成员故障,自动会转移到其他副本集一员。如果有不正常的表现,可以利用重启mongos进行进行重置

配置服务器故障:一个分片集群一般有三台配置服务器,如果有两台发生故障,那么剩余的配置服务器变为只读状态,所有的拆分和均衡操作都会停止。这个对集群的读写没有影响,当三条配置服务器恢复后,均衡器就会它停止的地方那个重新开始工作

mongos故障:如果mongos进程发生故障,一般重启应用服务器;

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 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 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)

How to update the latest version of Bybit Exchange? Will there be any impact if it is not updated? How to update the latest version of Bybit Exchange? Will there be any impact if it is not updated? Feb 21, 2025 pm 10:54 PM

The way to update ByBit exchanges varies by platform and device: Mobile: Check for updates and install in the app store. Desktop Client: Check for updates in the Help menu and install automatically. Web page: You need to manually access the official website for updates. Failure to update the exchange can lead to security vulnerabilities, functional limitations, compatibility issues and reduced transaction execution efficiency.

deepseek web version entrance deepseek official website entrance deepseek web version entrance deepseek official website entrance Feb 19, 2025 pm 04:54 PM

DeepSeek is a powerful intelligent search and analysis tool that provides two access methods: web version and official website. The web version is convenient and efficient, and can be used without installation; the official website provides comprehensive product information, download resources and support services. Whether individuals or corporate users, they can easily obtain and analyze massive data through DeepSeek to improve work efficiency, assist decision-making and promote innovation.

Pi Node Teaching: What is a Pi Node? How to install and set up Pi Node? Pi Node Teaching: What is a Pi Node? How to install and set up Pi Node? Mar 05, 2025 pm 05:57 PM

Detailed explanation and installation guide for PiNetwork nodes This article will introduce the PiNetwork ecosystem in detail - Pi nodes, a key role in the PiNetwork ecosystem, and provide complete steps for installation and configuration. After the launch of the PiNetwork blockchain test network, Pi nodes have become an important part of many pioneers actively participating in the testing, preparing for the upcoming main network release. If you don’t know PiNetwork yet, please refer to what is Picoin? What is the price for listing? Pi usage, mining and security analysis. What is PiNetwork? The PiNetwork project started in 2019 and owns its exclusive cryptocurrency Pi Coin. The project aims to create a one that everyone can participate

How to install deepseek How to install deepseek Feb 19, 2025 pm 05:48 PM

There are many ways to install DeepSeek, including: compile from source (for experienced developers) using precompiled packages (for Windows users) using Docker containers (for most convenient, no need to worry about compatibility) No matter which method you choose, Please read the official documents carefully and prepare them fully to avoid unnecessary trouble.

Coinsuper exchange software channel official website entrance Coinsuper exchange software channel official website entrance Feb 21, 2025 pm 10:39 PM

The official website entrance of the Coinsuper Exchange: https://www.coinsuper.com. The client download channels are: Windows client, macOS client, and mobile (iOS/Android). Registration requires an email, mobile phone number and password, and you need to complete real-name authentication before you can trade. The platform provides a variety of digital asset transactions, including Bitcoin, Ethereum, etc., with the transaction fee rate of 0.1% for both orders and acceptors. Security safeguards include cold wallet storage, dual-factor verification, anti-money laundering and anti-terrorism financing measures, and with security public

Ouyi okx installation package is directly included Ouyi okx installation package is directly included Feb 21, 2025 pm 08:00 PM

Ouyi OKX, the world's leading digital asset exchange, has now launched an official installation package to provide a safe and convenient trading experience. The OKX installation package of Ouyi does not need to be accessed through a browser. It can directly install independent applications on the device, creating a stable and efficient trading platform for users. The installation process is simple and easy to understand. Users only need to download the latest version of the installation package and follow the prompts to complete the installation step by step.

BITGet official website installation (2025 beginner's guide) BITGet official website installation (2025 beginner's guide) Feb 21, 2025 pm 08:42 PM

BITGet is a cryptocurrency exchange that provides a variety of trading services including spot trading, contract trading and derivatives. Founded in 2018, the exchange is headquartered in Singapore and is committed to providing users with a safe and reliable trading platform. BITGet offers a variety of trading pairs, including BTC/USDT, ETH/USDT and XRP/USDT. Additionally, the exchange has a reputation for security and liquidity and offers a variety of features such as premium order types, leveraged trading and 24/7 customer support.

Get the gate.io installation package for free Get the gate.io installation package for free Feb 21, 2025 pm 08:21 PM

Gate.io is a popular cryptocurrency exchange that users can use by downloading its installation package and installing it on their devices. The steps to obtain the installation package are as follows: Visit the official website of Gate.io, click "Download", select the corresponding operating system (Windows, Mac or Linux), and download the installation package to your computer. It is recommended to temporarily disable antivirus software or firewall during installation to ensure smooth installation. After completion, the user needs to create a Gate.io account to start using it.

See all articles