Help us understand the problem. What is going on with this article?

The use of Data Migration tool from M1 to M2

More than 1 year has passed since last update.

The Beginnings:

This is the article for Magento 2 Advent Calendar 2018 on 19th day.

Today, I am going to write some of my experience on data migration from M1 to M2. It is a tool that is used for migrating data from Magento 1. X system to Magento 2. X system. By using this git hub link I tried to migrate data and setting from Magento1 to Magento2.

Execution Enviroment

Magnento 1 Server

Magento 1.7.0.2
Vagrant
Ubuntu 18.04.1 LTS
PHP 7.1.23
MySQL 5.7.24 Apache 2.4.29

Magnento 2 Server

Magento 2.2.7
Vagrant
Ubuntu 18.04.1 LTS
PHP 7.1.23
MySQL 5.7.24 Apache 2.4.29

References

http://devdocs.magento.com/guides/v2.0/migration/migration-tool.html
https://github.com/magento/data-migration-tool
http://devdocs.magento.com/guides/v2.0/migration/migration-manually.html
http://devdocs.magento.com/guides/v2.0/migration/migration-migrate-after.html

As I am doing this task for the first time it gives me lot of nightmare because of unknown errors I have faced.
By referring these links I have duplicate the Magento 1 DB and then move this to Magento 2 server by using Data Migration Tool.

Magento 1 DB replication step

For the Magento 1 DB replication I had done following steps:
1. Go to magento 1 mysql and then use command mysqldump -u root -p magento1 > magento1.dump this will dump the db of Magento 1.
2. Then move this dump file of Magento 1 into Magento 2 server.
3. Now create new DB name magento1db and then use command mysqldump -u root -p magento1db < magento1.dump this will restore the magento 1 db into Magento2 server. This completes replication of Magento 1 db.

Installation of Data Migration Tool

I have used this github link https://github.com/magento/data-migration-tool to install the data migration tool.
1. First command is composer config repositories.data-migration-tool git https://github.com/magento/data-migration-tool
2. Second command is composer require magento/data-migration-tool:2.2.6

Here 2.2.6 is the data migration tool version I'm going to use.
Now we need to setup the config files which are located into the Document root/vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.7.0.2.
The installed directory should be as follows:
スクリーンショット 2018-12-19 18.34.46.png

There are two files we need to change. First one is config.xml.dist and next is map.xml.dist.

スクリーンショット 2018-12-19 18.41.43.png

In config.xml.dist file we need to change the following:
スクリーンショット 2018-12-19 18.39.54.png

<source>
<database host="127.0.0.1" name="Magento1DB" user="username" password="password"/>
</source>
<destination>
<database host="127.0.0.1" name="Magento2DB" user="username" password="password"/>
</destination>
<options>
<crypt_key>The secret key of Magento1 directory app/etc/local.xml</crypt_key>
</options>

Here, we need to replace username by the actual username of Magento 1 and Magento 2 and so as password field.

The crypt_key field need to be replaced by the secret key found in the Magento 1 directory /app/etc/local.xml. Now next step is to migrate data and settings.

Migrating data and settings

For migrating process I had used following procedures:
1. sudo php /var/www/magento2/bin/magento migrate:settings -vvv vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.7.0.2/config.xml.dist this will migrate all the settings from M1 to M2.
2. sudo php /var/www/magento2/bin/magento migrate:data -vvv vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.7.0.2/config.xml.dist this will migrate all the data and tables of M1 to M2.

If this completes with no errors then data migration is completed.
But in my case gives the error like this:


[2018-10-16 17:10:27][INFO][mode: data][stage: integrity check][step: EAV Step]: started
[2018-10-16 17:10:27][INFO][mode: data][stage: integrity check][step: Customer Attributes Step]: started
[2018-10-16 17:10:27][INFO][mode: data][stage: integrity check][step: Map Step]: started
[2018-10-16 17:10:27][INFO][mode: data][stage: integrity check][step: Url Rewrite Step]: started
[2018-10-16 17:10:27][INFO][mode: data][stage: integrity check][step: Log Step]: started
[2018-10-16 17:10:27][INFO][mode: data][stage: integrity check][step: Ratings Step]: started
[2018-10-16 17:10:27][INFO][mode: data][stage: volume check][step: EAV Step]: started
100% [============================] Remaining Time: 1 sec
[2018-10-16 17:10:27][ERROR]: Class catalog/product_attribute_backend_finishdate does not exist but mentioned in: eav_attribute.backend_model for attribute_id=78
[2016-09-13 21:48:27][ERROR]: Class category_attribute_source_block_proportions does not exist but mentioned in: eav_attribute.source_model for attribute_id=138

To resolve this issue I have used this command sudo php /var/www/magento2/bin/magento migrate:data -r -a vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.7.0.2/config.xml.dist
this will just ignore all those missing fields and settings.
This command will successfully complete the data migration process.

After Data Migration

The last but least I need to do further procedures:
1. Run the cache clean steps to clear the cache of Magento 2. command is php bin/magento cache:clean
2. Reindex all the tables and data using command php bin/magento indexer: reindex

This will reflect all the migrated data into the website. Now, run the web url and see the changes by yourself.

Finally

I tried to do all the data migration procedure without having any troubles during the steps. But it gave me lot of troubles and at last I was able to solve all of those troubles. But after the completion this first migration step I was able to cope with all the troubles and able to complete data migration successfully in other two data migration projects.

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした