我正在将一个论坛从 myBB 转换为 IPBoard(转换是通过 PHP 脚本完成的),但是我有超过 400 万个帖子需要转换,按照目前的速度大约需要 10 个小时。我基本上有无限的 RAM 和 CPU,我想知道如何加快这个过程?有没有办法可以为这个进程分配大量内存?谢谢你的帮助!
3 回答
You're not going to get a script to run any faster. By giving it more memory, you might be able to have it do more posts at one time, though. Change memory_limit
in your php.ini
file to change how much memory it can use.
You might be able to tell the script to do one forum at a time. Then you could run several copies of the script at once. This will be limited by how it talks to the database table and whether the script has been written to allow this -- it might do daft things like lock the target table or do an insanely long read on the source table. In any case, you would be unlikely to get more than three or four running at once without everything slowing down, anyway.
It might be possible to improve the script, but that would be several days' hard work learning the insides of both forums' database formats. Have you asked on the forums for IPBoard? Maybe someone there has experience at what you're trying to do.
不确定转换是如何完成的,但是如果您正在导入一个 sql 文件,您可以将其拆分为多个文件并同时导入它们。希望有帮助:)
如果您说您已经转换了文件,您应该查看MySQL Load Data In FIle以进行导入,因为您可以访问 MySQL 控制台。这将比通过 source 命令执行 SQL 语句快得多。
如果文件中没有它们并且正在动态执行它们,那么我建议让转换脚本将数据写入文件(将时间限制设置为 0 以允许它运行)然后使用该负载data 命令插入/更新数据。