In accordance with a 2022 report by Veeam, 76% of companies suffered a minimum of one ransomware assault throughout the previous yr. Extra importantly, over one-third of the compromised information (36%) was unrecoverable after the assault.
Luckily, for those who’re a Magento retailer proprietor, you don’t want to fret about information loss as a result of Magento gives a built-in backup software that simplifies on-demand backups.
On this information, we’ll clarify every thing you have to find out about Magento 2 backup, together with the way it works and tips on how to again up Magento 2 appropriately.
Right here’s every thing we’ll cowl:
Magento 2 Open Supply gives an in-built backup module that permits you to again up completely different components of your retailer in two methods:
Adobe Commerce Cloud customers can use the above strategies and in addition create a snapshot of their utility atmosphere utilizing the Mission Net Interface. The snapshot creates an entire backup of all companies working on the server, equivalent to Redis, MySQL, and Magento.
In distinction, the strategies for Magento Open Supply allow you to backup the next three components of the system:
Whenever you backup Magento 2 utilizing the built-in backup system, Magento creates a .sql file for the database and a .tgz compressed archive file for the file system and media backup information. It locations the backup information contained in the var/backups listing till you delete them manually.
Be aware: Adobe deprecated the built-in backup function of Magento 2, beginning with model 2.3.0 and above. Be sure to check the Magento 2 backup performance in a staging atmosphere earlier than utilizing it on a manufacturing server.
Log in to your Magento server because the filesystem proprietor and navigate to the undertaking root listing. Then, run the next CLI command to allow the Magento backup utility:
$ bin/magento config:set system/backup/functionality_enabled 1
Earlier than making a backup, be sure you replace the open information’ restrict worth for the Magento file system person. A low open information restrict worth can result in failed backups and rollbacks utilizing the Magento backup software.
Adobe recommends setting the open information restrict worth to 65536 or extra. Nonetheless, you should utilize a bigger worth in case your system helps it.
Run the next command because the Magento filesystem person to replace the open information restrict:
$ ulimit -s 65536
Confirm the ulimit is up to date utilizing:
$ ulimit -n
You may backup Magento 2 from the terminal utilizing the next CLI command syntax:
$ php bin/magento setup:backup [--code] [--media] [--db]
You can even specify a number of choices to again up completely different components of your Magento retailer. As an example, you may create a backup of the database and file system utilizing the next command:
$ php bin/magento setup:backup --code --db
As soon as the command executes efficiently, you need to see the next output:
Alternatively, you can too backup Magento 2 through the admin panel by navigating to System > Instruments > Backups and choosing one of many following three choices:
On the Backup choices web page, enter a reputation on your backup and tick the Upkeep mode checkbox to modify your on-line retailer to upkeep mode through the backup course of. When you’ve configured the backup choices, click on Okay to provoke the backup.
The backup course of can take wherever from just a few seconds to a number of minutes, relying on the scale of your retailer, your server configuration, and the kind of backup you’ve chosen. As soon as it completes, you’ll see a message confirming the backup is full as follows:
Optionally, you may schedule every day, weekly, or month-to-month Magento 2 backups on a predefined schedule from the admin panel.
Log in to the Magento admin panel and navigate to Shops > Settings > Configuration > Superior > System.
Broaden the Backup Settings part and replace it as follows:
After that, click on Save Config to replace your settings.
When you create a Magento 2 backup, you may confirm it from the admin panel by navigating to System > Instruments > Backups. The newly created backup will show inside a grid as follows:
Alternatively, you may confirm it in your terminal utilizing the next Magento CLI command:
$ php bin/magento information:backups:checklist
You must see the next output:
Warning: Restoring a Magento 2 backup erases all the info generated by your ecommerce retailer after the backup was created. This motion is everlasting, and you can not reverse it.
You may roll again to a Magento 2 backup from the admin panel by navigating System > Instruments > Backups and clicking on the Rollback hyperlink of your most popular backup.
On the following web page, configure the next settings:
Lastly, click on Okay to proceed.
Alternatively, you may restore a Magento 2 backup through the command line. To try this, log in to your server because the Magento file system proprietor, navigate to the Magento undertaking root, and execute the next command to output a listing of current backups:
$ php bin/magento information:backups:checklist
The command to revive a backup varies primarily based on the backup sort. As an example, you may restore a database backup utilizing:
$ php bin/magento setup:rollback -d <backup_filename>
Equally, you may roll again the file system backup utilizing:
$ php bin/magento setup:rollback -c <backup_filename>
And eventually, to revive the media folder backup you should utilize:
$ php bin/magento setup:rollback -m <backup_filename>
Whenever you execute a command, Magento will immediate you to confirm if:
Reply “y” or “N” to each prompts. Because the rollback completes, you need to see an output much like:
We’ve defined the fundamentals of the Magento 2 backup software and the steps to again up Magento 2 in two methods. Though Adobe has solely deprecated the software in Magento model 2.3 and later, it’s attainable that it’d take away the software in a future launch.
Don’t wait till then to discover an alternate backup answer on your Magento retailer. Join managed Magento internet hosting with Nexcess at present and entry on-demand and automatic nightly backups at no further price.
Browse our plans to get began at present.