4 April 2019

How to backup your M2 store

Hello there and welcome back to another blog
by Hussey Coding.

In this blog, we will be looking at how to backup your Magento 2 store.

If you are still using Magento 1 then we do have another blog that shows you how to back up an M1 store, to read it click HERE. We recommend migrating to M2 as soon as possible since all official M1 support has stopped from Adobe. And yes, we know there are still some developers offering support to M1 users, but they won't be around forever, as technologies and systems move on, so will the developers.


For more information on switching to M2, you can e-mail us at info@husseycoding.co.uk. Alternatively, you can head to www.developerconnection.co.uk where you can find developers to help you with migration and all of your other Magento project needs.


If you have been using computers for any length of time, you will understand the necessity of backups. But if you are anything like me you will have learned this lesson a little too late … like after you already lost everything. The thing is that even now, having been through that experience, I still put off backing up my files, photos and other bits of info. How much more important then is it to back up your store? But again, how often do you actually do it?


Since you are reading this, I will assume that today is the big day! You have decided to backup your store but maybe you aren't sure how or you just need a little reminder of one step or two. My friend, you have come to the right place!


In this blog, we will show you

- How to enable backing up your store

- How to schedule your stores backup and

- How to manually backup your store


Before we begin

You need to understand that when using this method to back up your M2 store, the Magento platform will be putting all of its resources into the backup. This means that you won’t be able to do anything at all while it is backing up!


Obviously the more you backup, the longer the process will take so think carefully about when you want to do it. If your store is at its busiest between 12pm and 3pm then that's not the time you want to be backing up. Alternatively, if you don’t want to suffer any downtime at all, there are other tools you can use to avoid this. However, they are quite in-depth and complicated so we would advise you contact your store support team if you have one. If not, we are happy to either help you backup your store or in some cases, we can do it for you, just e-mail us at info@hussyecoding.co.uk for more info.


Enabling & Scheduling backups

The M2 backup function is disabled by default, so you are going to have to change it manually before you can initiate any backups. To do this, open your Magento administration menu, go to STORES in the toolbar on the left and under the heading SETTINGS, click on CONFIGURATION.

 

 
On the new screen, scroll all the way down to ADVANCED and click SYSTEM.


On this screen, scroll down a little to see BACKUP SETTINGS and expand the box. You will see that the default setting is set to NO, just drop down the box and select YES.

Most importantly, remember to click SAVE CONFIG in the top right corner or, you will need to come back and do all of this again.



Scheduling backups

Unlike the M1 setup, the option for enabling and scheduling are conveniently in the same place so we will cover scheduling now since you will already be on this screen. If you have already enabled backups, then just follow the steps above to reach your scheduling options. 


To schedule your backups first change the NO to YES in the drop-down box.



A drop-down menu will appear with a few more options for you. Just fill them in as you would like and your all done. We will look at these options in greater detail in a moment when we look at manually backing up your store.


As with M1, you can only set your store to schedule 1 backup in total. If you wanted to do weekly Database backups and monthly System backups, then you would need to change the settings each time. Again, don’t forget to click SAVE CONFIG in the top right-hand corner to avoid disappointment.


 

Manually backing up your Magento v2 store.

To manually backup your store access your M2 administration menu. On the left toolbar, scroll down to SYSTEM and click on it. In the pop-out window, look for the heading TOOLS and scroll down until you see BACKUPS and click on it.



 
You’ll be brought to a new screen where you will have 3 options.

SYSTEM BACKUPDATABASE AND MEDIA BACKUP and DATABASE BACKUP. You must know the difference between these to you know what you are backing up.




System backup

What it does - Creates a complete backup of the database and the file system. In the next step, you can choose whether to include the media folder to the backup. 


When to use it - This is your big backup, the one that will save everything! The big deal here is your files. If you import any files to make changes to your store from anywhere outside of the Magento framework you want to do a System backup. If you don’t and your store gets deleted, you are going to have to reload all of those files all over again. You have the option here to backup your media files too, so all of your stock pictures, videos etc.


Database and media backup

What it does - Creates a backup of the database and the media folder.


When to use it – This option will backup everything apart from any external files that you have used to edit the store. Whatever changes you have made within the Magento framework are included in this backup, as well as all of your media files.


Database backup

What it does – Creates a backup of the database.


When to use it – This is your basic backup. All the changes you have made to your store within the Magento framework are backed up but nothing else.


Once you have chosen which type of backup you’d like to perform, click on it and a window will pop out. The options here are the same as M1, except for SYSTEM BACKUP. Unlike M1 your option here is to exclude rather than include your media folders. By ticking the box you will choose NOT to save your media during this backup.



Backup name – This is optional, if you don’t give it a name then the system will just allocate a name to it which is fine but it will make it harder for you to find a specific backup if you have a lot of files.


For example, let's say I’m running 3 stores, 1 for the U.K., 1 for the U.S.A. and 1 for the French side of my business. There is a big French holiday coming up that I want to take advantage of by completely rearranging my store for one weekend. But what I don’t want to do is spend hours changing it and then hours putting it back to the way it was so I make the choice to backup the store.

I click my preferred option in backup and I call the file “French store before big weekend event April 2019”.

 

This makes it much easier for me to find that backup. If you don’t back up a lot then it may not be a big issue for you. But if you have a lot going on with your site and multiple users backing up then not naming your files could become a nightmare for you and your team.



Then there is a tick box that we highly recommend you click. Basically, this will redirect customers to a page that tells them your site is undergoing some maintenance and will be back up and running as soon as possible. Magento will automatically take you out of maintenance mode once your backup is complete so you don’t have to worry about checking up on it.


Click OK and, you will see a PLEASE WAIT wheel. Now just let it do its thing while it’s backing up. Again, please do remember that once you begin a backup you cannot do anything from either the front end or back end of your store, you have been warned!


And that’s it, you are now the proud owner of a backed-up M2 store! Congratulations. Thanks again for joining us today, we hope this blog has been helpful to you. Until next time, stay safe and have a great day.

You can also join all the fun on our various social media profiles
Facebook - facebook.com/husseycoding
Twitter - twitter.com/husseycoding
LinkedIn - linkedin.com/company/hussey-coding

Sign up to developer connection at www.developerconnection.co.uk
Facebook - facebook.com/DeveloperConnection
Twitter - twitter.com/devconnectionuk
LinkedIn - linkedin.com/company/developer-connection

 

No comments:

Post a Comment