mysql pt_mysql之pt工具之pt-fifo-split用法介绍
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                mysql pt_mysql之pt工具之pt-fifo-split用法介绍
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.                        
                                在工作中用到也比較多,在load data大文件時,如果文件太大會導致主從延時等問題,必須得將文件拆分成許多小文件,使用這個工具就不需要人工進行切割文件。
此工具只能工作在類unix操作系統。具體的可以查看: http://www.mysqlperformanceblog.com/2008/07/03/how-to-load-large-files-safely-into-innodb-with-load-data-infile/
在一個session中執行如下命令:
perl pt-fifo-split infile.txt --fifo /tmp/my-fifo --lines 1000000
在另一個session執行如下命令:
while [ -e /tmp/my-fifo ]; do
time mysql -e "set foreign_key_checks=0; set sql_log_bin=0; set unique_checks=0; load data local infile '/tmp/my-fifo' into table load_test fields terminated by '\t' lines terminated by '\n' (col1, col2);"
sleep 1;
done
總結
以上是生活随笔為你收集整理的mysql pt_mysql之pt工具之pt-fifo-split用法介绍的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: 虚拟机开启mysql密码报错_Linux
- 下一篇: mysql数据库ab复制_mysql r
