LoginSignup
0
0

More than 5 years have passed since last update.

Magento2 Data Migration Toolを使ってみた。その2

Last updated at Posted at 2016-12-12

この記事は、Magento Advent Calendar 2016 12日目の記事です。

Magento2 Data Migration Toolを使ってみた。その1
http://qiita.com/tsuchiyawantan/items/ee9f74f76cd6be2bf140
の続きです。

Migrate

次に、migrateしていきます。
sudo php /var/www/magento2/bin/magento migrate:settings -vvv vendor/magento/data-migration-tool/etc/ce-to-ce/1.9.2.3/config.xml
-vvv をつけると、debugしてくれます。
sudo php /var/www/magento2/bin/magento migrate:data -vvv vendor/magento/data-migration-tool/etc/ce-to-ce/1.9.2.3/config.xml
sudo php /var/www/magento2/bin/magento migrate:delta -vvv vendor/magento/data-migration-tool/etc/ce-to-ce/1.9.2.3/config.xml
これを順に実行していきます。
これが最後まで終わればMigrate成功です。
最後のコマンドは、自動で終わらないため、同じような内容が出力されつづけているようならCtrl-Cで止めちゃってOKです。

が、しかしエラーでこけました(私の場合)。

エラー1

[2016-10-27 04:23:45][INFO][mode: settings][stage: integrity check][step: Settings Step]: started
[2016-10-27 04:23:45][INFO][mode: settings][stage: integrity check][step: Stores Step]: started
100% [============================] Remaining Time: 1 sec
  [Migration\Exception]
  Integrity Check failed

Exception trace:
 () at /var/www/magento2/vendor/magento/data-migration-tool/src/Migration/Mode/Settings.php:58
 Migration\Mode\Settings->runIntegrity() at /var/www/magento2/vendor/magento/data-migration-tool/src/Migration/Mode/Settings.php:28
 Migration\Mode\Settings->run() at /var/www/magento2/var/generation/Migration/Mode/Settings/Proxy.php:95
 Migration\Mode\Settings\Proxy->run() at /var/www/magento2/vendor/magento/data-migration-tool/src/Migration/Console/MigrateSettingsCommand.php:51
 Migration\Console\MigrateSettingsCommand->execute() at /var/www/magento2/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
 Symfony\Component\Console\Command\Command->run() at /var/www/magento2/vendor/symfony/console/Symfony/Component/Console/Application.php:874
 Symfony\Component\Console\Application->doRunCommand() at /var/www/magento2/vendor/symfony/console/Symfony/Component/Console/Application.php:195
 Symfony\Component\Console\Application->doRun() at /var/www/magento2/vendor/magento/framework/Console/Cli.php:49
 Magento\Framework\Console\Cli->doRun() at /var/www/magento2/vendor/symfony/console/Symfony/Component/Console/Application.php:126
 Symfony\Component\Console\Application->run() at /var/www/magento2/bin/magento:25
migrate:settings [-r|--reset] config

スタックトレースは下から上へと見ていくので、一番上がエラー原因だとわかります。
() at /var/www/magento2/vendor/magento/data-migration-tool/src/Migration/Mode/Settings.php:58
ここで、Settings.phpに対しecho var_export($result, true);を適当な場所に入れて実行。
オブジェクトがtrue or falseどちらを返してるか確認します。
object->perform()でpreformメソッドのif (!in_array(self::CONFIG_TABLE_NAME_SOURCE, $documents)) {でエラーが出ているのがわかりました。
mage1DBの設定がうまくいってなかったので、(DB名間違いだった気がします)configを直しました。

エラー2

Base table or view not found: 1146 Table 'magento1database.magentocore_store' doesn't exist,
このようなエラーが出ました。
テーブル名にprefixがついているようです。
そういえばconfigファイルで、source_prefixを設定していました。削除すれば直ります。

Migrate後

最後の仕上げです。
1. migration toolで移動できないデータは手動で移動します。
DBにmedia fileを置いている場合は手動で動かします。
Magento1のmediaからMagento2のpub/mediaへ。
2. Magento1をメンテナンスモードにします。
ドキュメントルートに、maintenance.flagを作成するだけでOK
3. Magento2でcronを走らせます。
4. Magento2のキャッシュを消します。
php bin/magento cache:clean
5. reindexします。
php bin/magento indexer:reindex

終わりです。

まとめ

かなりいろんなところでハマりましたが、無事移行できたのでよかったです。
移行できるバージョンとできないバージョンがあったので、何回もMagento入れなおしましたが、良い勉強となりました。
1.9.3を移行しようと思ったら、migration toolには1.9.2までしかなかったり。。。(2016/10月時点)
まだまだ修行したいと思います。

次回は、OG3_Asaxさんです。宜しくお願いします。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0