简体   繁体   English

Mysqldump花费太多时间

[英]Mysqldump taking too much time

MySQLdump and upload process taking too long time (~8 hr) to complete the whole process. MySQLdump和上载过程花费太长时间(〜8小时)来完成整个过程。

I am dumping active database into mysqldump.tar file and almost 3gb. 我正在将活动数据库转储到mysqldump.tar文件和将近3gb中。 When I load into new database its taking 6-8 hr to complete the process (upload into new database). 当我加载到新数据库中时,它需要6到8个小时才能完成该过程(上传到新数据库中)。

What will be the recommended solution for me to complete the process? 对我来说,完成该过程的推荐解决方案是什么?

If I understand correctly, your main problem is that loading the data into your new database is the step that's taking a lot of time. 如果我理解正确,那么您的主要问题是将数据加载到新数据库中需要花费大量时间。 Besides reading the link provided by asdf in his comment ( "How can I optimize a mysqldump of a large database?" ), I suggest you some things: 除了阅读asdf在他的评论中提供的链接( “如何优化大型数据库的mysqldump?” )之外,我还建议您做一些事情:

  • Use the --disable-keys option; 使用--disable-keys选项; this will add alter table your_table DISABLE KEYS before the inserts, and alter table your_table ENABLE KEYS after the inserts are done. 这将在插入之前添加alter table your_table DISABLE KEYS ,并在插入完成之后添加alter table your_table DISABLE KEYS alter table your_table ENABLE KEYS When I've used this option, the insertion time is about 30% faster 使用此选项后,插入时间大约快30%
  • If possible, use the --delayed-insert option; 如果可能,请使用--delayed-insert选项; whis will use INSERT DELAYED insted of the "normal" INSERT . 这将使用INSERT DELAYED的“普通” INSERT
  • If possible, dump the data of different tables into different files; 如果可能,将不同表的数据转储到不同文件中; that way you may upload them concurrently. 这样,您可以同时上传它们。

Check the reference manual for further information. 检查参考手册以获取更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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