使用需要MySQL的导入脚本

You’ll need to modify the script to import the data. The bbpress script imports only posts of a particular type (I likely don’t remember the right wordpress lingo). What kind of WP posts do you want to import? Which are topics and which are posts? Is there something like categories? Those are just a few questions you’ll need to answer by modifying the script. How to do that is beyond the scope of the support you’re likely to get here.

Edit:I’ve retired a few times and gotten closer… Now:

At step 2, mysql -u$MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE < /backup/yourbackup.sql i get the error bash: /backups/yourstratapropertywordpress.sql: No such file or directory when it does exist (at least, in /var/backups it does)

If I jump ahead and try su discourse -c "bundle exec ruby script/import_scripts/bbpress.rb" anyway, I get the following result:

Loading existing users...
Loading existing categories...
Loading existing posts...
Loading existing topics...
Traceback (most recent call last):
        5: from script/import_scripts/bbpress.rb:512:in `<main>'
        4: from script/import_scripts/bbpress.rb:512:in `new'
        3: from script/import_scripts/bbpress.rb:21:in `initialize'
        2: from script/import_scripts/bbpress.rb:21:in `new'
        1: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/mysql2-0.5.3/lib/mysql2/client.rb:90:in `initialize'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/mysql2-0.5.3/lib/mysql2/client.rb:90:in `connect': Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) (Mysql2::Error::ConnectionError)

Thanks! I will take a look at the DB and the script and see if I can’t accomplish my purposes.

1 个赞

Good luck! I wrote at least a couple importers before I “learned” Ruby. If you have an understanding of SQL that could be acquired in an undergraduate course in the mid 1980s, you can likely pull it off. If you write the queries something such that the field names in the resulting data match what the script expect you might be able to change only the SQL.

@pfaffman I’d really appreciate your help here, I’m very stuck

I’m pretty slammed right now and this likely isn’t solved here. Email Jay@literatecomputing.com with a budget and I’ll do my best to come up with a solution.

This seems like your MySQL server is either not running or is not installed properly.

1 个赞

Success!

The post type should be post and needs to replace post_type topic. Tags were not brought over nor were the topics’ categories. All my posts were imported as an anonymous user, but it is certainly a decent start!

1 个赞

Glad you’re making headway!

感谢您提供的清晰指南,它帮助我理解了导入过程,而不是盲目地复制粘贴命令。

我仍在尝试找出导入一个非常大的 Drupal 论坛的最快方法,并且我仍然觉得在这种情况下可以进行优化,以便在最终生产论坛迁移运行时缩短一些停机时间。我可能算是个老手了,但我还没有完全接受 Docker/容器化的模式。我肯定在哪里读到过,曾经有一个 Docker 错误导致容器化 MySQL 实例的性能大大降低。在 Docker 论坛上,我看到了这份报告,但不确定它是否仍然相关。而且,由于我的主机运行的是 Debian 而不是 Ubuntu,所以它可能与我的情况无关。

另一种选择可能是将 MySQL 或 MariaDB 安装在容器外的宿主操作系统上?

而且,不深入细节的话,通过MySQLTuner的一些建议来优化 my.cnf 怎么样?适用于所有实例的标准 Docker 配置不可能在其缓冲池实例和键缓冲大小方面做到最优,而这些在专用的生产数据库上会产生巨大影响。

您好。感谢您的解决方案。我遇到了您在文章中提到的 gem 问题,因此我非常期待让它正常工作。此方法是否适用于将 WordPress bbpress 论坛(托管在 DreamPress 上)迁移到 Discourse 实例(托管在 Digital Ocean 上)?

我正在使用 Digital Ocean 的基于 Ubuntu 的 droplet 和 Web 终端/控制台。我的第一个问题是,当我运行 /var/discourse/launcher stop app /var/discourse/launcher rebuild import 时,会发生什么?Web 终端/控制台应该关闭吗?我尝试过这样做,但 import.yml 文件似乎没有保存。它会恢复到其默认状态。

另外,有人能解释一下我的设置是否需要运行可选的第二步吗?

提前非常感谢。

附注:我愿意付费请人来做,但我的预算仅限于 200 美元。

也许你想把它发到#marketplace。

1 个赞