我正在将论坛从 myBB 转换为 IPBoard(转换是通过 PHP 脚本完成的),但是我有超过 400 万个帖子需要转换,按照当前速度大约需要 10 个小时。我基本上有无限的 RAM 和 CPU,我想知道的是如何加快这个过程?有没有一种方法可以为这个进程分配大量内存?
感谢您的帮助!
I'm converting a forum from myBB to IPBoard (the conversion is done through a PHP script), however I have over 4 million posts that need to be converted, and it will take about 10 hours at the current rate. I basically have unlimited RAM and CPU, what I want to know is how can I speed this process up? Is there a way I can allocate a huge amount of memory to this one process?
Thanks for any help!
发布评论
评论(3)
您不会让脚本运行得更快。不过,通过给它更多的内存,你也许可以让它一次发布更多的帖子。更改
php.ini
文件中的memory_limit
以更改它可以使用的内存量。您也许可以告诉脚本一次只处理一个论坛。然后您可以同时运行该脚本的多个副本。这将受到它与数据库表的通信方式以及是否编写了允许这样做的脚本的限制——它可能会做一些愚蠢的事情,例如锁定目标表或对源表进行疯狂的长时间读取。无论如何,在一切都减慢的情况下,你不可能同时运行超过三到四个。
也许可以改进脚本,但这需要花费几天的时间来学习两个论坛数据库格式的内部知识。您是否在 IPBoard 论坛上询问过?也许那里有人对你想做的事情有经验。
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 yourphp.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 文件,您可以将其拆分为多个文件并同时导入它们。希望有帮助:)
not sure how the conversion is done, but if you are importing a sql file , you could split it up to multiple files and import them at the same time. hope that helps :)
如果您说您已经转换了文件,则应该查看 MySQL 在文件中加载数据以进行导入。这将比通过源命令执行 SQL 语句更快地加载数据。
如果文件中没有它们并且您正在即时执行它们,那么我建议让转换脚本将数据写入文件(将时间限制设置为 0 以允许其运行),然后使用该加载data 命令用于插入/更新数据。
If you are saying that you have the file(s) already converted, you should look into MySQL Load Data In FIle for importing, given you have access to the MySQL Console. This will load data considerably faster than executing the SQL Statements via the source command.
If you do not have them in the files and you are doing them on the fly, then I would suggest having the conversion script write the data to a file (set the time limit to 0 to allow it to run) and then use that load data command to insert / update the data.