A murder caused by data loss in a MONGO database

Source: Internet
Author: User

January 8, 2017 No, a sunny morning (Big Weekend on the sunny morning), I still in the dream, was awakened by a telephone, it is known that the most feared to do operation and maintenance of the company during the rest of the phone calls!

Cause: A colleague says a function on the line is not available! (This function is to get the data back to the front end for rendering in the MONGO database)

After: There have been similar problems, after troubleshooting is because the MONGO instance hangs (for some reason), this time did not think of things than the previous failure to call people creepy----------MONGO data lost my days AH. There are less than 50 million data stored in it. How did you get this?

Solution: Put MONGO data loss keyword put on google on a search, saw a post, "a large number of MongoDB due to configuration vulnerabilities were attacked, hackers delete data and ransom", thought the data is likely to have a relationship with this matter!

Luckily for me, my MONGO data is backed up one day. Or I don't know who to cry for.

Data restore: Get back the backup of this straw, Heart (RI) (TA) stealing (Lao) Hi (Lao)! My MONGO architecture is to do the master-slave read-write separation mode, first without validating the way to start the MONGO of the main, slave, quorum node

For more information on how to configure the master-slave read/write separation technology for MONGO, see another article in the Small series: http://www.cnblogs.com/xinzhiyu/p/5907542.html

./mongod-f master.conf #启动主节点./mongod-f slave.conf #启动从节点./mongod-f arbiter.conf #启动仲裁节点

Look at the contents of the configuration file:

Master.conf

dbpath=/disk/mongodb/data/masterlogpath=/disk/mongodb/log/master.logpidfilepath=/disk/mongodb/ master.piddirectoryperdb=truelogappend=truereplset=testrsbind_ip=192.168.30.250port=27017oplogsize=10000fork= Truenoprealloc=true

Slave.conf

dbpath=/disk/mongodb/data/slaverlogpath=/disk/mongodb/log/slaver.logpidfilepath=/disk/mongodb/ slaver.piddirectoryperdb=truelogappend=truereplset=testrsbind_ip=192.168.30.251port=27017oplogsize=10000fork= Truenoprealloc=true

Arbiter.conf

Dbpath=/disk/mongodb/data/arbiterlogpath=/disk/mongodb/log/arbiter.log Pidfilepath=/disk/mongodb/arbiter.pid  Directoryperdb=true logappend=true replset=testrs bind_ip=192.168.30.251port=27018oplogsize=10000 fork=true Noprealloc=true

Use the MONGO command to connect to the master database and create an administrator account.

./mongo--host=192.168.30.250:27017


This article is from the "Loyalty" blog, make sure to keep this source http://xinsir.blog.51cto.com/5038915/1890428

A murder caused by data loss in a MONGO database

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.