MongoDB Hot Backup test and pain points

Source: Internet
Author: User
Tags mongodb server mongodb version percona mongodump


650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/9C/36/wKioL1ltqUiiTzA6AAA5puBC1Ro224.png "title=" 3.png "alt=" Wkiol1ltquiitza6aaa5pubc1ro224.png "/>

Percona MongoDB hot Backup test and Pain Point Preface

Part1 : write at the top

Percona MongoDB supports Hot Backup, which solves the situation where the official MongoDB version can only use Mongodump. Mongodump in the small library Fortunately, after the volume, backup recovery is painful. This article is to reproduce and resolve a bug in the MongoDB hot backup backups.


Actual combat

Part1: Limit

Before the Percona MongoDB3.2.12 version, when a physical hot backup is made, if the configuration file

Directoryperdb:true

Directoryforindexes:true

These two parameters, the error will be burst when performing the backup:

[Email protected] Bin]#./mongo 127.0.0.1:27020/adminmongodb shellversion:3.2.11-3.1 connecting to:127.0.0.1:27020/ Admin Heleitest:primary>use adminswitched to db Adminheleitest:primary>db.runcommand ({createbackup:1, Backupdir: "/home/work/backup"}) {"OK": 0, "errmsg": "Boost::filesystem::copy_file:no such file or directory:\"/home/mo Ngodb/data/admin/collection/11-6714811575794894766.wt\ ", \"/home/work/backup/admin/collection/ 11-6714811575794894766.wt\ ""}



Part1: Pain Point

This problem will be very headache, such as the production library, the MongoDB library is getting bigger, prompting us to plan to adopt the hot backup solution, because the first library opened this way, then what is the temporary solution?

it may be useful to simply let a  secondary initial sync with those options off, then you  Could take a hot backup again to populate all the other  nodes. This is not a solution but a path to get  The production system back into a state you can use the  backups. please note this assume production is built to  best practices and is in a replica-set and not a stand  Alone mongod process. 

This means that in our regular replication set of MongoDB, if you want to back up this library, it is very slow and complex to start off with a secondary and empty the data directory for re-copying. If you just restart the database, you will not get an error, because you have opened the Multipath storage data and index isolated storage both options, and the existing version of Hotbackup is not supported by such a backup method.



Part2: Programme

Fortunately, the Percona version of the response to the Force, in the spring Yang teacher proposed the bug, the official version of the 3.2.12-3.2 fixed this issue, so that hot backup pain points to solve, for example, I need to re-close the cluster parameters, export import data, This is undoubtedly a huge workload, while keeping the reliability of the database in a low state for a short period of time. Now, all we have to do is upgrade the database and the problem can be solved.



Part3: reproduce

[[email protected] bin]#./mongo 127.0.0.1:27020/adminpercona Server for MongoDB Shell version:3.2.12-3.2connecting to:1 27.0.0.1:27020/admin heleitest:primary> Db.runcommand ({createbackup:1, Backupdir: "/home/work/backup"}) {"OK": 1}


Let me start with an upgrade to the previous 3.2.11-3.1 version, how to upgrade the MongoDB database can be consulted:

http://suifu.blog.51cto.com/9167728/1947035

At the same time, the configuration file is configured with the

Directoryperdb:true

Directoryforindexes:true

As you can see, in the 3.2.12-3.2 version, the backup is free of any exceptions.



PART4: Checksum

let's see the 3.4 . whether the latest version is also normal

[[email protected] bin]#./mongo 127.0.0.1:27020/adminpercona Server for MongoDB shell version v3.4.4-1.4connecting To:mo Ngodb://127.0.0.1:27020/adminpercona Server for MongoDB server version:v3.4.4-1.4heleitest:primary> Db.runCommand ({createbackup:1, Backupdir: "/home/work/backup"}) {"OK": 1}


As you can see, the latest version is no problem.



Part5: Percona official upgrade log

#PSMDB -123:fixed the creation of proper subdirectories inside the backup destination directory


He chun Yang teacher submitted Jira

Https://jira.percona.com/browse/PSMDB-123


-- summary --

thanks to the Yang teacher's bug submission, thank Percona team efficient repair rate, open source, make the world a better ~ because Pen People's level is limited, writing time is also very hasty, the text will inevitably appear some errors or inaccurate places, the wrong place to ask readers to criticize correct.


This article is from the "He Lei Technology Blog" blog, make sure to keep this source http://suifu.blog.51cto.com/9167728/1948583

MongoDB Hot Backup test and pain points

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.