One of the most important aspects of running any online store is keeping a proper backup of everything so that in case anything goes wrong you can restore it with ease anytime. You can also adjust settings and edit your site without worrying that your web page will go offline. So as you can see, maintaining a backup of the site is pretty important.

The functionality is built-in Magento 2 to ensure that the backup is created of the data and then it can restore all the codes, media and also your site’s database whenever you require it. At times it is a critical task to restore backups.

There are many options available if you desire to make a back up of your site’s data. Through this article, we will guide you in steps how you can do the process of backing your data and then how you can restore it by the use of CLI commands.

So let’s get started!

Before We Begin

Before going further, you must check that you have installed a working Magento 2 beforehand on your system. Now access the installation of your Magento 2 via the shell and you have to use SSH. First login via SSH, after this go to the app which is present at the root folder, bin, var folders are placed of Magento 2.

Backup/Snapshot – How To Do It

Once you are done with the step of changing Magento 2 directory to the root of it, install and run the command below:

PHP Code:
php bin/magento setup:backup -v –code –media –db 
It will create three types of backups which include:

  1. Code
  2. Media, for example, the pictures or videos, etc.
  3. The data’s Database which is of high necessity for your store.

Note that during the backup of your store, as it will change the mode of your site to maintenance mode. During the back up the live site of your store will not be available during backup and all of the backups will be stored in the var/backups

Read Complete Article Here:

View more threads in the same category: