python 子线程coredump_python多线程备份mysql数据工具:mysqlpdump使用方法
mysql的備份工具有很多,但是很多都備份比較慢,那有沒辦法多線程進行備份呢?分享一個python多線程備份mysql數據工具:mysqlpdump使用方法:
mysqlpdump自己的介紹:
MySQL Parallel Dump
Multi threaded mysqldump is not an utopia any more. mysqlpdump can
dump all your tables and databases in parallel so it can be much faster
in systems with multiple cpu’s.
It stores each table in a different file by default. It can also
generate the dump to stdout although this is not recommended because it
can use all the memory in your system if your tables are big.
看說明,mysqlpdump 默認就是采用分表備份的,而且多線程,充分利用cpu。這個還有說明,就是說,mysqlpdump可以利用內存直接將備份輸出出來,但是對于大表不建議這么干,可能會掛掉的。
mysqlpdump需要的系統需求:
Python 2.4
MySQL-python module
一般python應該都在python 2.4 以上,另外需要 MySQL-python 模塊支持,可以用 pip 安裝就行了
mysqlpdump使用方法
Usage
簡單的用法: (將會把每個表備份為一個文件):
mysqlpdump.py -u root -p password
Save compressed files (gzip) to /tmp/dumps and pass "–skip-opt" to
mysqldump:
mysqlpdump.py -u root -p password -d /tmp/dumps/ -g -P "--skip-opt"
Output to stdout and use 20 threads:
mysqlpdump.py -u root -p password -stdout -t 20
Be more verbose:
mysqlpdump.py -u root -p password -v
備份包含 "mysql" 和 "test"的表:
mysqlpdump.py -u root -p password -e mysql -e test
僅僅備份 "mysql" 表:
mysqlpdump.py -u root -p password -i mysql
項目地址:https://github.com/fr3nd/mysqlpdump?? 大家自己去玩玩吧。
總結
以上是生活随笔為你收集整理的python 子线程coredump_python多线程备份mysql数据工具:mysqlpdump使用方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 情人节专属礼物!小米Civi 2 Hel
- 下一篇: pythonelectron桌面开发案例