MySQL备份之mydumper入门学习(6)

mydumper -u zjy -p xxx -h 192.168.123.70 -P 3306 -t 5 -c -r 300000 -l 3600 -s 10000000 -B vs -o /home/linuxidc/vs/

表示每个线程用300000行块来分割表,通过show processlist 看到:5个线程备份

| Sending data |
SELECT /*!40001 SQL_NO_CACHE */ * FROM `virtual_station`.`core_event` WHERE `id` IS NULL OR (`id` >= 1 AND `id` < 446597) | | Sending to client |
SELECT /*!40001 SQL_NO_CACHE */ * FROM `virtual_station`.`core_error_log` WHERE `id` IS NULL OR (`id` >= 1 AND `id` < 351238) | | Sending to client |
SELECT /*!40001 SQL_NO_CACHE */ * FROM `virtual_station`.`core_event` WHERE (`id` >= 893193 AND `id` < 1339789) | | Sending to client |
SELECT /*!40001 SQL_NO_CACHE */ * FROM `virtual_station`.`core_event` WHERE (`id` >= 1339789 AND `id` < 1786385) | | Sending data |
SELECT /*!40001 SQL_NO_CACHE */ * FROM `virtual_station`.`core_error_log` WHERE (`id` >= 702475 AND `id` < 1053712) |

这个可以更好的备份数据库,不管数据库里是否有大表。

总结:

从上面的测试分析中看出mydumper可以提升备份还原的效率,虽然是多线程操作,但是提升多少受限于磁盘的IO能力,在使用前做好磁盘IO的评估,大家可以尝试使用该工具。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/d8ad485910e0710c862f82bc3b15a779.html