Moving your Magento 1 to Magento 2 may be one of the most challenging things out there. Luckily, Magento supported us with a database migration option.
The Magento 2 Data Migration Tool is here to help you convert your products, customers, order/sales data, store configuration, promotions/sales rules, and more to move to a clean Magento 2 setup.
Custom code, Extensions, and Themes are out of the current scope of the Data Migration Tool.
The currently supported migrations are the Community Edition (CE) versions 1.6.x, 1.7.x, 1.8.x, and 1.9.x and Enterprise Edition (EE) versions 1.11.x, 1.12.x, 1.14.x, and 1.14.x.
Before we can start migrating our system, we need to check the following:
A migration of Magento 1 to Magento 2 has the following five phases that are important to follow in the correct order:
The command is php bin/magento migrate:settings
.
The command is php bin/magento migrate:data
.
The command is php bin/magento migrate:delta
.
/media
to /pub/media
.For the purpose of this recipe, let's assume that we need to manage a Magento 1 to Magento 2 migration setup. The following steps will guide you through this:
data-migration-tool
to your current Composer setup:composer config repositories.data-migration-tool git https://github.com/magento/data-migration-tool-ce composer require magento/data-migration-tool:dev-master
Wait while all dependencies are updated.
bin/magento
shell tool:
Commands |
Description |
---|---|
migrate | |
|
Main migration of data |
|
Migration of the data that is added to Magento after the main migration |
|
Migration of the system configuration |
php bin/magento setup:uninstall
Go to /var/www/html/vendor/magento/data-migration-tool/etc/ce-to-ce
and pick the correct database version mentioned in the directory. If correct, you will see two files called config.xml.dist
and map.xml.dist
.
config.xml.dist
to config.xml
using the cp
command:cp config.xml.dist config.xml
config.xml
and look for the <source>
tag (line 94). Change it accurately with the database username and password:<source> <database host="localhost" name="magento1" user="root" password="mypassword"/> </source> <destination> <database host="localhost" name="magento2" user="root" password="mypassword"/> </destination> <options> <source_prefix>myprefix-from-magento1</source_prefix> <crypt_key>mycrypt-key-from-magento1</crypt_key> </options>
If you are using a custom prefix in your database or you wish to use your encryption key on your Magento 2 setup, you can add this to the <options>
section, as shown in the previous code.
php bin/magento migrate:settings /var/www/magento2/vendor/magento/data-migration-tool/etc/ce-to-ce/1.9.2.2/config.xml
As you can see, here we are using the 1.9.2.2 version. Depending on your version, you may change this before running the command.
The output result looks like this:
[2015-12-02 20:28:56][INFO][mode: settings][stage: integrity check][step: Settings Step]: started 100% [============================] Remaining Time: 1 sec [2015-12-02 20:28:56][INFO][mode: settings][stage: integrity check][step: Stores Step]: started 100% [============================] Remaining Time: 1 sec [2015-12-02 20:28:56][INFO][mode: settings][stage: data migration][step: Settings Step]: started 100% [============================] Remaining Time: 1 sec [2015-12-02 20:28:59][INFO][mode: settings][stage: data migration][step: Stores Step]: started 100% [============================] Remaining Time: 1 sec [2015-12-02 20:28:59][INFO][mode: settings][stage: volume check][step: Stores Step]: started 100% [============================] Remaining Time: 1 sec [2015-12-02 20:28:59][INFO][mode: settings][stage: volume check][step: Stores Step]: Migration completed
php bin/magento migrate:data /var/www/magento2/vendor/magento/data-migration-tool/etc/ce-to-ce/1.9.2.2/config.xml
The output result looks like this:
php bin/magento indexer:reindex php bin/magento cache:clean php bin/magento cache:flush
migration.log
file located in /var
.delta
option, we push the data to Magento 2 using the following command:php bin/magento migrate:delta /var/www/magento2/vendor/magento/data-migration-tool/etc/ce-to-ce/1.9.2.2/config.xml
The output result looks like this:
Let's recap and find out what we did throughout this recipe. In steps 1 through 14, you learned how to use the Magento 2 migration tool.
In step 1, we used Composer to add an additional repository for data migration. After installing all of the packages, they are available in the bin/magento
tool. In this setup example, we used a clean Magento 1.9.x database.
In step 4, we made sure to run on a clean Magento 2 setup. Depending on your setup, go to vendor/magento/data-migration-tool/etc
and select the correct version. Magento 2 supports the migration option for CE and EE. Once we configured the config.xml
file with the Magento 1 database information in step 6, we were ready to go.
In step 7, we used the bin/magento
migration setting to start the whole process. We started with the setting parameter and continued with the data
and delta
parameters in steps 7 through 13. We must not forget the reindexing and updating of our caches before using them. The delta
parameter option can be run multiple times as it only updates the latest information, which is helpful before going live and switching to production.
As every Magento setup is unique, migrating from Magento 1 to Magento 2 can be hard sometimes. In some situations, you may need to change your tables in the mapping configuration located in vendor/magento/data-migration-tool/etc/ce-to-ce/<version>map.xml.dist
.
Resetting your setting, data, and delta migration is easy using the [-r|--reset]
parameter in your command. This allows you to rerun all migration scripts from the beginning.
Always check for the currently supported versions on the Magento GitHub Data Migration Tool page at the following link:
https://github.com/magento/data-migration-tool-ce
There is also an alternative Data Migration Tool available by UberTheme at https://github.com/ubertheme/magento2_data_migration.
18.118.2.240