Can you remember the last time you took a copy of your current Magento site and stored it in a safe location? Most Magento merchants can’t. Here at Customer Paradigm, we work with clients of many shapes and sizes, but one common theme is how infrequent backups are made.
In this article we will talk about:
- Why Backups Matter
- When You Should Backup
- How to Perform a Backup on Your Magento 2 Store
Why Backups Matter
The type of events where you are in need of a site backup are rarely planned. When a Magento site functions smoothly with few problems you are rarely thinking about doing backups – often merchants do not consider this need until it’s too late. When your Magento site is not functioning correctly is when a backup can save you hours of work and thousands of dollars.
“Merchants rarely think about the need to perform regular site backups until it’s too late.”
While Magento 2 is considered a secure platform, there are always unexpected ways in which a store could break.
For example, a server can unexpectedly crash, corrupting your store files making them no longer usable.There is also the threat of hackers. Hackers have been known to encrypt or remove essential parts of a Magento site until the owner pays a ransom – threats that eCommerce stores are particularly prone too as hackers want to get customers personal payment information. Or maybe, an unintentional command by a developer removes every file from a directory. We have seen clients attempting to delete a single folder not realizing they were at the wrong location and completely wiped out an entire site. This is where backups can restore your site quickly and easily.
When Should You Perform a Backup?
The answer to this question is right now. Exploits, bugs, hacks, crashes, and mistakes can happen at any time.
However, an immediate backup requires a Magento store owner to first be thinking about the need for a backup. While expecting your site to break at any moment is not something you should be living your life in fear of, it is always good to plan for the worst – especially when it comes to protecting your livelihood. As they say, “An ounce of prevention is worth a pound of cure.”
There are a few steps you can take to ensure your data remains protected. Every live Magento site is a constantly changing set of data. Every site visit, image change, and order placed is data that is stored for later use.
It’s important to remember that even restoring to a backup of your site in the event that something happens will only bring back the information that was last saved.You might be wondering why not just save a copy of the data every minute 24/7 to protect everything on the site (however, this is not a logical solution for a couple of reasons).
Here are a couple of things to keep in mind while setting up a simple backup system:
- How much space do you have?: Most hosting companies will charge you more for taking up more space. More space means more servers and that incurs costs. Just as your phone or computer will run slow or crash when you run out of space, a server operates in the same manner. A full server will not be able to add more data to capture an order or write a log file when errors occur. Backups, especially full backups, can include all of the site media, and can take up a lot of space.
- How much time do you have?: Full backups take time. Data can only be saved as fast as it can be written. On large sites, we have seen backups take hours to fully complete. Sometimes it is not essential to backup everything, every time to you do a backup – not every aspect of your site changes every day or even every month.
- Backing up data takes processing power: Running a full backup can pull a large amount of processing power from your server. If timed incorrectly, this performance impact can have negative repercussions on your customer experience. Pulling a database backup will lock tables during the process, therefore slowing down the ability for new data to be entered into the site. Typically, we suggest running backups overnight, in maintenance mode, or during a calculated period of light traffic on the site.
- Hosting companies might be able to help: Many Magento hosting providers will include some type of backup service with the hosting package. This is to protect them just as much as it is to protect you. Server hardware can be faulty, break unexpectedly, and require maintenance. Find out if this is an option with your hosting provider, and if it is, make sure this option has been set up and is available for you to access in case of an emergency.
Performing Backups on Magento 2
There are two main ways to set your site up for a backup to occur. You can run a backup from the command line of your server or from the Magento 2 backend administrative dashboard. This is a very simple process and will cover all of the data that it takes to run a basic Magento store.
For any backup, you can collect either the code, the media (images and video files), or the database.
Magento Backup via Admin Panel
After logging into the Admin panel, navigate to System > Tools > Backups
This page will give us our backup options.
- System Backup is going to be the files and the code itself.
- Database Backup is going to be database tables containing items like: order, customer information, and admin configurations.
- Media Backup will be all of your media folders. This will often be the largest backup as it contains your images and videos.
After selecting the Backup you would like to perform, you will see a page that allows you to name the backup file. We suggest naming the file with the date and type of backup in the name for easy reference.
Your next option is to place the site into maintenance mode during the backup. We suggest you do this during any backup to limit the amount of data that is changing during the backup process.
The final option is if you would like to exclude the media folder from the backup. As mentioned before, this is often the largest set of files and for many sites, these elements are not going to change as frequently as other areas of the site.
Once the file has been created you will be able to click on the filename to download the backup to your local computer. You will also have the option to restore your site back to that version of the site. This is a very powerful tool that will remove any of the new data on your Magento site that was not included in that backup. Make sure you understand the data you will be removing by restoring to one of your backup files.
Magento Backup via Command Line
This is something most store owners are not going to interact with but our developers often find it is easier, often Magento developers will make a backup from the command line before making any large changes to your live Magento site.
For more information on running backups and restoring from the command line the Magento Dev Docs have a nice step by step guide with notes on restoring correctly.
Every Magento store owner should have a backup strategy in place in case of a site catastrophe. In the rapidly changing eCommerce industry, store owners need to manage their data responsibly. A major part of being prepared for the worst case scenarios includes how to get your site back up and running as quickly as possible. Restoring from a backup version of your site is one way to responsibly manage data to mitigate a disaster. While it’s not a perfect system, and some data could still be lost, it is still preferable to the cost of losing an entire site.
Need help managing your Magento data? Want to keep your store secure? Connect with Customer Paradigm today to start reaching your eCommerce goals.
About Bruce Vissing
Bruce is the Lead Project Manager at Customer Paradigm. Bruce has a passion for problem-solving and helping his clients find the ideal eCommerce solutions for their business. When he is not helping his clients, or guiding the Customer Paradigm Project Management Team, you can find him training his award-winning hamsters. You can expect to see him and his 3-time reigning national award-winning hamsters competing on Tuesday evenings at 8pm Slovak Time on the Ocho.