By now, it is widely known that in June 2020 Magento 1 will reach ‘End of Life’. It seems like there is a lot of time ahead until this happens, but it is never too early to start the migration from Magento 1 to Magento 2 platform.
In order to properly migrate from one platform to another, a good strategy is simply a must. Of course, the strategy should consist of a series of carefully thought out steps. Based on our experience with this type of migration, we suggest the following steps:
- M1 Extensions Review
- Magento 2.3 Hardware Recommendations
- Magento 2.3 Technology Stack Requirements
- Install Magento 2.3
- Install Data Migration Tool
- Migration Testing
- Start the Migration
- The Final Steps
Let’s go through the process of migration, step by step, and by the end of the article, you will have all the necessary pieces of information for when you decide to upgrade your web store from the M1 to the M2 platform.
Magento 1 Extensions Review
Before you start the migration, you should thoroughly go through all of your Magento 1 extensions and make a list. Then make sure that there are equivalent extensions for Magento 2. If that is not the case, consider a fitting replacement. The good thing is that if you cannot find the same extension, you will surely find an improved version that might be even more appropriate for the needs of your online store. Moreover, since the M2 platform has got many new features, there is a number of extensions that may be added in order to enhance the performance and design of your store.
On Magento Marketplace you can find all M1 and M2 extensions sorted in the following categories: Accounting & Finance, Content & Customization, Customer Support, Marketing, Payments & Security, Reporting & Analytics, Sales, Shipping & Fulfillment, and Site Optimization. Also, you can filter your search by choosing the platform, edition, version, price range, partner type, and ratings.
Magento 2.3 Hardware Recommendations
The first thing that you should do is to determine the number of web nodes/cores needed for processing the incoming requests. In order to do this, you should use the following equation: N[Cores] = (N[Expected Requests] / 2) + N [Expected Cron Processes]. The number can be increased manually depending on your store’s load. Also, you can use an auto-scaling model for an automatic extension of web tiers.
When it comes to PHP memory requirements, they can vary depending on the type of system deployment. For setting up a single server store, you should configure PHP memory for 2GB, as recommended by Magento developers. Should you decide to use a pipeline deployment, it is highly recommended to build a server on 2GB and web nodes on 1GB.
Considering the fact the fact that the Magento 2 database is sensitive to the available amount of memory for data and indexes storage, MySQL data indexation should be adequately leveraged. According to the Magento DevDocs, “the amount of memory available should be, at minimum, close to half the size of the data stored in the database”.
If you are using Redis or Varnish for caches when deploying multiple Magento 2, you should pay close attention to a couple of important things. Varnish full page cache memory invalidation is able to hold your most popular pages in memory. For the website’s cart abandonment strategy, the best thing is to configure session cache memory for a separate instance of Redis.
The key factor for deciding on the amount of memory to configure is the block cache. This type of cache can grow depending on the number of pages on a website: the number of SKUs x the number of store views.
Magento 2.3 Technology Stack Requirements
Magento 2.3 is supported on Linux x86-64 distributions: RedHat Enterprise Linux (RHEL), CentOS, Ubuntu, Debian, etc. It is not supported on Windows OS and Mac OS. The upgrade to M2 can require up to 2GB of RAM.
If you are developing Magento extensions, you should have the latest version of Composer installed. As for the web servers, you will need Apache 2.4 with the mod_version module and nginx 1.x. If you need more information about Apache and the module, you can read Apache documentation.
When it comes to databases, Magento 2.3 is compatible with MySQL 5.6, MySQL 5.7, MySQL NDB Cluster 7.4, MariaDB 10.0, MariaDB 10.1, MariaDB 10.2, Percona 5.7, as well as other binary-compatible MySQL technologies. Magento 2.3 supports a couple of versions of PHP, including ~7.1.3, ~7.2.0, and ~7.3.0.
The required PHP extensions include: ext-bcmath, ext-ctype, ext-curl, ext-dom, ext-gd, ext-hash, ext-iconv, ext-intl, ext-mbstring, ext-openssl, ext-pdo_mysql, ext-simplexml, ext-soap, ext-spl, ext-xsl, ext-zip, and lib-libxml. Should you be in need of some help with the installation, you can always follow the official PHP documentation. Also, you should check if PHP OPcache is enabled.
As for your security, you should have a valid SSL and TLS 1.2 or later. The required Magento system tools are: bash, gzip, lsof, mysql, mysqldump, nice, php, sed, and tar. You will also need MTA or an SMTP server, Redis 3.2, 4.0, or 5.0, Varnish 4.x, 5.2 or 6.2, Elasticsearch PHP client 6.1, RabbitMQ 3.7.x, and php_xdebug 2.5.x or later, which is optional, but recommended. Note that Magento Commerce Edition requires three master databases, for checkout, orders, and the remaining applications.
Install Magento 2
Before you start the installation of Magento 2, you should check the availability of the releases and features. Moreover, you can find useful information in the form of a tutorial and reference. Just go through the sample installation and refer to the roadmap, and each part of the installation process would be clear to you. Prior to the whole process, it is extremely important to provide root privileges for a web server, as well as for the Magento file system owner. After creating the owner, you should add it to the web server’s group, and then you will be able to use it to run commands and set up the Magento cron job for scheduling your tasks.
Should you need a detailed guide for installing Magento 2 on Ubuntu 16.04, you should read one of our previous blog posts.
Install Data Migration Tool
In order to use the Data Migration Tool version 2.3.3. you have to make sure that you have the same release of Magento installed. There are two ways to check your Magento version. If you have downloaded Magento with a composer metapackage, the following command will discover the release of your software:
$ php <magento_root>/bin/magento --version
In case you have cloned the Magento 2 GitHub repository, you should run the following commands:
$ cd <your Magento 2 clone directory> $ git branch
To do the former, you need to update composer.json in the Magento root installation directory by entering the following commands:
$ composer config repositories.magento composer https://repo.magento.com $ composer require magento/data-migration-tool:<version>
Note that the <version> must match the Magento 2 codebase version.
Then, when it is indicated, enter your public key (username) and your private key (password).
To do the latter, enter the following command to the Magento root directory:
$ composer config repositories.data-migration-tool git https://github.com/magento/data-migration-tool $ composer require magento/data-migration-tool:<version>
Note that the <version> must match the Magento 2 codebase version.
When you change to your Data Migration Tool directory:
Then open composer.json in a text editor where you can see the version of your Data Migration Tool.
One of the key steps before the migration itself is migration testing. Prior to the actual migration, you should first copy your Magento 1 store to a staging server. It is advisable to start with a limited data set, and then add other data in bulk. Migrate the replicated Magento 1 store to Magento 2 and test your new store in great detail.
Go through all of the extensions and make sure that all of them are compatible with Magento 2. This is a great opportunity to revise your inventory. Decide whether to keep all or some of it.
Start the Migration
With the Data Migration Tool, it is easy to copy your M1 shop data to a new M2 shop. Before you start to migrate data from Magento 1, you must check the database connection. You need to set the correct database credentials in the database section of the app/etc/config.php file. After that, you can start the migration.
Also, if you have custom fields (not Magento default), when you run the command for migration you must get an error message “Source fields are not mapped“. You can use param -a or –auto to ignore all differences.
You can do 3 things with the Data Migration Tool. Firstly, you can migrate config data from your Magento 1 to Magento 2.
$ php bin/magento migrate:settings /path/to/config.xml
With this command, you can copy config data from the core_config_data database table. All configuration data can be found in the Store >System >Configuration.
Secondly, you can migrate all data like products, customers, and orders to your Magento 2 with the following command.
$ php bin/magento migrate:data /path/to/config.xml
And finally, the main advantage of this tool is importing deltas. It means that you can only change data from the last import. This functionality saves and minimizes downtime if you switch from Magento 1 to Magento 2.
$ php bin/magento migrate:delta /path/to/config.xml
More on Manual Migration
More on Automatic Migration
When you run the Data Migration Tool, you have to be prepared for the possible errors during the process. For example, if source documents/fields are not mapped, you can add the <ignore> tag to an entity in the map.xml file.
... <source> <document_rules> ... <!-- Ignore `sales_flat_invoice_grid` table --> <ignore> <document>sales_flat_invoice_grid</document> </ignore> </document_rules> <field_rules> <!-- Ignore `address_id` field of `sales_flat_order_address` table --> <ignore> <field>sales_flat_order_address.address_id</field> </ignore> ... </field_rules> </source> ...
Another possible solution to this problem might be to use the -a argument when executing the tool. It will auto-resolve errors and prevent the migration from stopping.
If it happens that URL rewrites get duplicated for some reason, there’s an easy fix. Try enabling the auto_resolve_urlrewrite_duplicates option in your config.xml file.
More on Troubleshooting
The Final Steps
After the migration, the first step is to test the Magento 2 website in great detail. Then, put the Magento 1 website in maintenance mode, and stop all Admin activities for good. After that, you should start Magento 2 cron jobs, flush all M2 cache types, and reindex all M2 indexers. Finally, change DNS and load balancers so that they all point to Magento 2 production hardware.
If you follow these steps, you are sure to perform the M1-M2 migration successfully. Even though the official support for M1 will be available until June 30, 2020, it is not the reason to postpone the migration. Moreover, you should upgrade your business as soon as possible. Embrace new features, enhanced performance, and improved security of a newer version of this incredible platform.
If you need professional help with the migration of your website, do not hesitate to contact us at [email protected]
Source: Magento DevDocs