Skip to main content
Blog General

Magento 2 – Data Migration

Suresh Selvam
February 9, 2016 |

We’ve migrated millions of SKU’s for our clients with zero data loss. Let’s get started with Magento migration now. Talk to us!

Data Migration Tool for Community Edition was recently released by Magento.

Before you begin the Data Migration, it is important to keep in mind the below points for successful migration

  • Don’t make any changes in Magento 1 Admin except for Order Management.
  • Stop all cron jobs in Magento 1
  • Don’t alter any code
  • Don’t make changes in Magento 2 Admin and Storefront. 
Supported Versions

Following versions are supported for Migration

  • Community Edition (CE) version 1.6.x, 1.7.x, 1.8.x, 1.9.x
  • Enterprise Edition (EE) version 1.11.x, 1.12.x, 1.13.x, 1.14.x
Migration Tool – Terminologies

There are a lot of differences in the structure and format of data between Magento 1 and Magento 2. The custom mapping of structure and data between Magento 1 and Magento 2 are declared in the mapping files. If the mapping is not done properly, then there will be errors in data migration processing.

Map – set of rules that describe connections between Magento 1.x and Magento 2.0 data structures

Mode – Mode of operation in Data Migration through basic commands.

  • Settings – Migrates all possible configuration settings from 1.x to 2.x
  • Data – Bulk migrates data from your Magento 1 DB to your Magento 2 DB
  • Delta – Incremental “catch-up” migration after the initial bulk data migration 
Migration Plan
  • STEP 1: Review your current site (Extensions and Modules)
  • STEP 2: Capacity Planning (Servers)
  • STEP 3: Build and Test the Magento 2
  • STEP 4: Start Your Migration
  • STEP 5: Incremental Updates
  • STEP 6: Go Live
Data Migration Flow Chart

data Migration 1

 Prerequisites
  • Install new Magento 2 environment on the server.
  • Stop Magento2 cron Jobs
  • Backup the Magento 2 database.
  • Check the data migration access to both Magento 1 and Magento 2 databases.
Installation, Configuration, and Mapping

Data Migration tool is not an extension, it is a shell app which requires Magento 2 Framework to work. The data migration tool for the Community Edition is available only in GIT HUB.

Install from GITHUB (Update through Command Line)

After installation, the following directory contains the mapping and the configuration file

/vendor/magento/data-migration-tool/etc/ce-to-ce

Configuration

  • Choose the right folder based on your Magento version.
  • Copy the config.xml.dist to config.xml

– Database details and its credentials of Magento 1.X

– Database Details and it credentials of Magento 2.X

crypt_key – Encryption key from Magento 1.X (local.xml).

Mapping Files

Data Migration tools use the mapping files to perform custom mapping between Magento 1 and Magento 2 including

  • Changes in the table name and field name
  • Ignoring tables and fields
  • Transferring the table / field 

The following image is an example of Map Configuration file

MAP Steps

  • Based on the Configuration file chosen, copy the map.xml.dist to map.xml
  • Make necessary changes in Config.xml
  • Transferring most of the data from Magento 1 to Magento 2
  • This step reads instructions from map.xml

Areas

  • Source – contains rules of source database
  • Destination – contains rules of destination database

Options

  • ignore – document, field or data type marked with this option will be ignored.
  • rename – describes name relations between documents with the different name. In a case when destination document name is not the same with the source document – you can use rename option to set source document name similar to destination table name.
  • move – sets the rule to move specified field from source document to destination document. NOTE: destination document name should be the same with the source document name. If source and destination document names are different – you need to use rename option for the document that contains moved field.
  • transform – is an option that allows the user to migrate fields according to behavior described in handler
  • handler – describes transformation behavior for fields. To call the handler, you need to specify.
Run the Data Migration Tool

Command

bin/magento migrate: [-r|–reset] {}

–  settings / data / delta.

The Data Migration Tool saves its current progress as it runs. If errors or user intervention stops it from running, the Data Migration Tool resumes progress from the last known good state.

Manual Migration (Media, Storefront design, and ACLs)

Media

  • All media files (for example, images for products, categories, the WYSIWYG editor, and so on) should be copied manually from /media to /pub/media.
  • However, do not copy .htaccess files located in the Magento 1 media folder. Magento 2 has its own .htaccess that should be preserved.

Storefront Design

  • Design files (CSS, js, templates, XML layouts) location and format have been changed.
  • Layout Updates stored in the database.

ACLs (Access Control Lists)

  • You must manually re-create all credentials for web services APIs (that is SOAP, XML-RPC, and REST)
  • You must manually re-create all administrative users and associate them with access privileges
After Migration

Start Magento 2 CRON jobs

Flush all Magento 2 cache types

  • magento cache:status
  • magento cache:enable [type] … [type]
  • magento cache:disable [type] … [type]
    • magento cache:disable db_ddl full_pagemagento cache:clean [type] … [type]
  • magento cache:clean [type] … [type]
  • magento cache:flush [type] … [type]
    • magento cache:flush –all

Re-index all Magento 2 indexers

  • magento indexer:info
  • magento indexer:status [indexer]
  • magento indexer:reindex [indexer]

Hope this article helps you. Good Luck for your Data Migration.

References

Suresh Selvam

Suresh, Technical Architect, is one of the senior most employees of DCKAP. He is Magento Developer Plus certified and an all-rounder with a range of technical & management skills. In crisis (technical or otherwise) , he steps in and restores order. He is helpful and always a phone call away.

More posts by Suresh Selvam