Transferring Magento Data to Auto-Scalable Clustered Infrastructure
As the time goes by and your project grows, you may face a need to transfer your Magento instance to more powerful host or even to another cloud hosting provider. Recently, we’ve considered how to ensure sufficient reliability of your service with Auto-scalable Magento Cluster in Docker containers solution by Jelastic, thus today’s article will be focused on moving the already existing project to such advanced infrastructure. To make this process as easy as it’s possible, we’ve prepared a separate dedicated Magento Data Migration add-on, which is devoted to transferring user and configuration data from any 3rd-party Magento installation to the clustered solution we propose.
So, below we’ll consider how to gain your project productivity by getting the required data dumps from your legacy Magento installation and importing them into a new highly-available scalable infrastructure within Jelastic Cloud.
Tip: Data transfer could be performed only between major Magento instances of the same version.
Exporting Magento Data
In order to import Magento data from another host to Jelastic, at first you need to export your Magento database and content into two separate archive files. Then, you can upload these files to any online storage file system and effortlessly transfer them to your Jelastic clustered environment.
Note: The instruction below describes procedure of database dump export for MySQL/MariaDB stacks as an example.To follow it, you’ll need access Linux servers where the corresponding DB service is running and Magento installation directory is located.
Exporting Magento Database Dump
The mysqldump client utility is used to export database data in a view of a single SQL file, i.e. to create a dump. Such file contains a set of statements that could be later executed on another SQL server in order to reproduce the original database object definitions and table data.
Note: To get a DB dump, you need to know the corresponding database name and credentials for a user account with sufficient permissions (at least, the read-only access is required).
So, to export your database, execute the following command.
mysqldump -u username -p databasename > filename.sql
Here, substitute the following placeholders with your custom data:
- username – a username you use to access your database
- databasename – name of the DB that should to be exported
- filename – name for a dump file within the current directory the SQL statements will be saved to
When executing mysqldump, no visual prompt is displayed; however, you can check the details on created dump file afterwards:
head -n 5 filename.sql
The content of the file will look similar to the one below, providing information on your database and used MySQL version.
When SQL file with your database dump is created, pack it into TAR.GZ archive and proceed to the next section.
Exporting Magento Content
To export the source Magento instance content (such as product and customer data), you need to access its installation directory at the appropriate server.
Tip: Depending on a server type your CMS is running at, path to its installation directory typically would be:
- for CentOS-based server – /var/www/html/magento
- for Ubuntu-based server – /var/www/magento
- for Docker Containers within Magento Cluster by Jelastic – /var/www/webroot/ROOT
After entering the Magento installation directory, you need to create a TAR.GZ archive with its content – run the following command to generate such package within the current directory.
tar -zcvf archivename.tar.gz source-directory
- archivename – name of the archive to be created
- source-directory – path to the Magento installation directory
Once the content is compressed, proceed with the following section to effortlessly transfer this data to Jelastic Cloud.
Importing Magento Data via Add-On
To integrate the earlier created TAR.GZ archive files to your Magento cluster, hosted at Jelastic, you need to upload them to any online storage system and then access your Jelastic Cloud dashboard to run the following steps.
Note: The Magento Data Migration add-on is designed to run a basic importing procedure that was tested on the sample Magento data. If your Magento installation contains extensive custom configuration settings, you will have to reapply them after migration.
1. Click Marketplace, switch to the Add-ons tab and use the embedded search box to locate the Magento Data Migration add-on.
Hover over the located add-on and click Install.
Tip: The Magento Data Migration add-on source is available within Jelastic JPS Collection on GitHub, alongside with a number of other useful prepackaged solutions (all of them can be installed through importing link to the manifest.jps link of the required repository).
2. Within the opened installation box, select the User data option and provide the following information:
- Database – link to a TAR.GZ archive file with Magento database dump
- Content – link to a TAR.GZ archive file with Magento content
Select the destination Environment name within the list of available ones and click on Install.
Wait a minute until transferring is finished. To check everything was completed successfully, refer to the data migration log file – click the Log button next to the Admin Node within your cluster.
In the opened tab, select the migration.log file within the left-side file tree to view its content – the very last string will indicate the status of the most recent data import operation.
That’s all! As you can see, the data from your original installation was successfully transferred to the new clustered Magento instance at Jelastic. Try it out by deploying Magento cluster solution to one of Jelastic Cloud Providers and importing the required data to it with the described dedicated add-on.
Have any questions on migrating Magento data to Jelastic? Do not hesitate to ask them within the comments below or get in touch with our technical experts at Stackoverflow.