Advertisement
  1. Code
  2. Magento
Code

Moving to Magento 2: Creating a Migration Plan

by
Languages:

Magento 2 was finally launched in November last year, after a very long wait. Apparently the wait was worth it, because the new version of Magento seems to be built on an altogether different architecture and is much more optimized, fast and user-friendly. If you are planning to build a new Magento store, it is almost a no-brainer that you should be using Magento 2 for your new Magento project. 

However, if you already have a Magento 1 store, the release of Magento 2 will put you in a bit of quandary on whether you should stick to Magento 1 or switch to Magento 2. In this article, and an upcoming article on the same topic, I’ll briefly discuss the migration process to Magento 2, and all the important aspects you need to consider for this migration.

Things to Consider Before Migration

The first decision you need to make here is: should you stick with Magento 1 for a while, or start the migration to Magento 2 right away? Here are a few things to consider while making this decision:

  • Magento 2 is indeed better and faster than Magento 1—there is no doubt about it. So, if you have just launched your store, or have little to no traffic to it at this stage, start the migration process right away.
  • If you are satisfied with your current Magento performance, and things are working fine for you with Magento 1, there is no urgent need to migrate to Magento 2. Just because Magento 2 is launched, it doesn’t mean Magento 1 is dead already. Magento has announced it’ll keep supporting Magento 1 for three more years—it just won’t release any more versions of Magento 1, and you won’t see many new Magento 1 themes and extensions. So, in short, you can keep using Magento 1 for a year or two without feeling the dire need to upgrade.
  • Refrain from the upgrading process if you currently have an important season for your eCommerce store. In the middle of popular shopping seasons like Black Friday or New Year Holidays, it’s a really bad idea to start changing your website configurations, because it can cause maintenance and downtime, and you never know when anything might go wrong. So why take the risk?
  • Another important thing to consider is whether the theme and extensions you are using for your Magento store are yet available for Magento 2. Magento 2 is just a few months old, so although the community is struggling fast to upgrade the existing extensions and themes, not all are Magento 2 compatible yet. So, if you have an important extension that isn’t Magento 2 ready yet, you should definitely wait!

The Migration Plan

If you have considered all the pros and cons of transferring to Magento 2 and have taken the decision to migrate, here is a brief overview of the steps required to transfer your site to Magento 2.

Review Your Website

As discussed above, have a good look at the availability of your required extensions and themes—you should be sure they are available in Magento 2. Also, look for any unnecessary extensions you can drop, as well as any database assets you have to migrate and any assets you can drop.

Planning for Infrastructure

Check with your hosting company if it has all the required capacity to host Magento 2 without a problem, and if it can also sustain and support your website when traffic scales in future.

Create a Magento 2 Store

Create a fresh installation of Magento 2, and after installation back up or dump your Magento 2 database as soon as possible

Next, start installing your required extensions on this fresh Magento 2 store.

Steps for Migration

Install the Magento migration tool (steps given below) and make sure it has access to both the Magento 1 and Magento 2 databases to start the migration process.

Stop Magento 1 cron jobs and also all the activity in the Magento 1 admin panel other than necessary order management issues, and do not resume the activity until the migration process is completed and the Magento 2 site goes live.

Manually transfer all the media files from your Magento 1 site to Magento 2, and use the Magento migration tool to migrate the settings to the Magento 2 site.

Now use the migration tool to completely transfer the Magento 1 database to the Magento 2 database. Both databases have different structures, but the migration tool knows what to transfer where, so that the data remains accessible in your Magento 2 installation. However, if you are using an extension which uses its own data, and when you transfer it to Magento 2 it has a different database structure for Magento 2, use the mapping files that come with the data migration tool.

Once you have completed the database transfer, reindex your Magento 2 site.

And, as always, the last step is to conduct thorough testing of your new Magento 2 site.

Post-Migration Steps

Although you stopped most activity in the Magento 1 admin panel before the start of the migration process, perhaps there were some order processing issues going on. Also, maybe new user reviews or changes in customer profiles occurred during this time. Now you need to migrate that data using incremental updates.

Once you've ensured that you have completely transferred all the data to your Magento 2 site, and everything is working absolutely fine, it’s time to go live. For that, put your Magento 1 site into maintenance mode, stop the migration tool, start Magento 2 cron jobs, and point your DNS load balancers to the new production hardware. And you are done!

This flowchart diagram explains all the steps for migration:

Migration Flow Chart

Image Source: http://devdocs.magento.com/guides/v2.0/migration/migration-overview-how.html

Note this was just an overview of the migration process so that you can properly plan for it. A more detailed explanation of all these steps will be given in an upcoming article on the same topic.

Best Practices to Consider

Though I’ll explain all the migration step details in the next article, here are some best practices to keep in mind:

  • Before migration, create a duplicate of the Magento 1 database, and connect your Magento 2 to that duplicate database. That's because if you accidentally connect to the Magento 1 live database, you’ll end up losing your Magento 1 database, and often database losses are irrecoverable.
  • After duplicating the Magento 1 database, only keep essential data in it and remove all unnecessary data from it. For instance, you can remove recently viewed and compared product records, some old promotional rules, logs, order quotes, etc.
  • Stop activity (except essential order management activity) in the Magento 1 admin panel before you start the migration process. If you make changes after creating a database duplicate, those changes won’t get transferred to your Magento 2 site.
  • Avoid all sorts of code changes during the migration process. Developers get the temptation to fix things as they come to their sight, but migration time is not the best time to do that. You can hold all these changes till the migration is successfully completed.
  • To boost the migration performance, you can set the <direct_document_copy>1</direct_document_copy> option in your config.xml. To do that, the Magento 1 and Magento 2 databases should be located in one MySQL instance, and the database account must access each database.

Now I'll give you an estimate of a professional migration process time, as given in the Magento devdocs. A Magento store hosted on VirtualBox VM, CentOS 6, 2.5Gb RAM, CPU 1 core 2.6GHz environment, with database of around 177k products, 355k orders, 214k customers took approximately 10 minutes to migrate settings and 9 minutes to migrate data, and the site had to remain in maintenance mode for a couple of minutes to reindex the Magento 2 site and to change the DNS settings.

Migration Tool vs. Manual Transfer

Though the migration tool is of great help for migrating your data and settings to Magento 2, not all the data can be transferred via this migration tool. These are the three types of data that you need to transfer manually (instructions on how to do that in next article):

  1. Media
  2. Storefront design
  3. ACLs (Access control lists)

Installing the Magento Migration Tool

Before you install the Migration tool, make sure you have completed all the steps in the ‘Review your website’, ‘Planning for infrastructure’ and ‘Creating Magento 2 store’ phases, as explained above. Once you have done all that, use the instructions below to install:

Log in to your Magento site server as the user with privileges to edit and create files.

Go to the Magento 2 root directory, and enter the following command to update the composer.json file first:

Next, enter the following command to require the current version of the package:

This will install version 2.0.0 of the package. If you intend to use a different package version, set the version in the command accordingly.

Wait while dependencies are installed. Once done, enter these two commands to install the migration tool:

When you run these commands, it’ll prompt you for authentication keys. For the public key, enter your username, and for the private key, enter your password. More information on authentication keys can be found in the Magento devdocs.

This should install the Magento migration tool on your Magento 2 store. We’ll use it to initiate and complete the transfer following the procedures explained in the next article.

In this article, my intention was to point out some key things to consider to help you decide if it's a good decision to migrate to Magento 2 for your store. I also gave an overview of the migration process for your planning purposes, and gave you some tips for best practices in the migration process. As a first step, we have also installed the Magento data migration tool.

We’ll proceed from where we have left today in the next article!

Advertisement
Advertisement
Looking for something to help kick start your next project?

Envato Market has a range of items for sale to help get you started.