简体   繁体   中英

Running mysqldump on live database

Just wanted to know what are the risks of running a mysqldump on a live database? Are there any chances of database corruption? mysqldump seems to lock the entire database.

What engine are your database tables using? If you are using transactional tables you can dump using the option "single-transaction", which will dump your tables in a consistent state. If you are using tables like MyISAM, which are non transactional, you should not have any DB corruption issues. You may have inconsistent data problems however, if you get into a race scenario. In either case, you will be dramatically slowing down DB response time while the dump occurs. Best bet is to run the dump against a slave or to wait for the site to be quiescent before running the dump.

from my experience, it is table locking when dumping. If your DB is on the large end, and u have heavy traffic, you'll essential back traffic up. I don't think data corruption would be an issue since it locks a table before dumping the data of that table. But If I am wrong about table lock and it is a DB lock, then you essentially turned off your DB for the duration of the dumping process, but that's what queue are for, when the dumping completes, it will start executing the queue in order as they received.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM