Magento 2 backup and rollback
If your budget is full for security, then I recommend you to use a backup service from the hosting service. Even so, you can expect much more with backup versions of your website’s best performance with backup methods from Magento 2. In this article, we will learn about the methods of Magento 2 backup and rollback.
1. Backup and rollback via the Command line
First connect to your Magento directory using SSH and make sure you are using write permission to the Magento file system.
Backup
Run the below commands:
php bin/magento config:set system/backup/functionality_enabled 1 php bin/magento setup:backup --code --media --db
When it success you can see file backup in the path var\backups.
Rollback
Before check list file backup with below command
php bin/magento info:backups:list
Then you can see below the screen
Now run the below command to rollback website
php bin/magento setup:rollback --code-file="1648697853_filesystem_code.tgz" --media-file="1648697853_filesystem_media.tgz" --db-file="1648697853_db.sql"
1. Backup and rollback via the Admin Panel
Backup
First, login to Admin Panel then check module backup status
After, go to System> Tools> Backups to choose the backup type
- In there
- – System Backup: will create copy of the database and the file system.
- – Database and Media Backup: will create copy of the current database and the media folder.
- – Database Backup: will create copy of the database
Rollback
Go to System> Tools> Backups in list backup file click to Rollback link.
Ok now you know how to Magento 2 backup and rollback. In the next posts we will learn how to move website to new service. Contact us if you face any problems during the installation process.