DigitalOcean offers two backups option, Backups vs. Snapshots. To enable automatically backups of a Droplet, do following these steps in this article.
1. Enable Automatically Backups
If you ensure your droplet system is currently running good, you can create for it a backup for the next restore. No one can guarantee that the system is always running well. Creating a backup system at the time it is well done is always a wise choice. Enabling the automatically backup feature is very simple and easy. You can be enabled or disabled it at anytime you want on DigitalOcean Control Panel. The backups are run automatically weekly.
Step 1: Go to DigitalOcean Control Panel.
Step 2: Click on the Backups link on the sidebar of the Droplet page.
Step 3: Click the blue Enable Backups button.
Beside, you can active this feature during create a new droplet by selected onto Enable Backups at the Available Settings.
2. Using the Snapshot feature
This feature cannot automatically running, you must manually doing this whenever you needs. DigitalOcean encourages powering off your droplet before making a backup using SnapShot. You can do this by the “Power Cycle” options within the control panel, but for safely and fastly, you typing the command “sudo poweroff” into the terminal when you are connected to the droplet.
Step 1: Connecting to your droplet, enter the command “sudo poweroff“.
Step 2: Logging to DigitalOcean Control Panel, choice the droplet you want to make a SnapShot in the main “Droplets” page:
Step 3: Next, Click to the Snapshots, then type the name you want for your snapshot. Finally, you press to the “Create” button to finished.
(When the snapshot process is complete, your server will be rebooted)
The Fee:
- Backups Pricing: Backups pricing is 20% off of the cost of your virtual server. This meaning if your plan pricing is $20/mo, the fee for backups will be $4/mo.
- Snapshots Pricing: The cost is based on utilized space within the filesystem. At this time, it's $0.05 per gigabyte per month. If you delete the Snapshots file before the month is over, the cost will be charged hourly.
How To Automatically Backup MySQL Databases
There are many ways to help you backup your database on DigitalOcean. In this article I will guide you through the “automysqlbackup” program on Ubuntu to do that.
Step 1: Type “sudo apt-get install automysqlbackup” to install this program.
Step 2: Configure AutoMySQLBackup
The main configuration file for automysqlbackup is located at “/etc/default/automysqlbackup/automysqlbackup.conf“. You will need to open this file and edit as per your requirements:
Open it:
Edit it:
CONFIG_mysql_dump_username='root'
CONFIG_mysql_dump_password='password'
CONFIG_mysql_dump_host='localhost'
CONFIG_backup_dir='/var/lib/automysqlbackup'
CONFIG_do_monthly=”01″
CONFIG_do_weekly=”5″
CONFIG_rotation_daily=6
CONFIG_rotation_weekly=35
CONFIG_rotation_monthly=150
CONFIG_mysql_dump_port=3306
CONFIG_mysql_dump_compression='gzip'
Then save and close it.
Step 3: Finally, type “sudo automysqlbackup” to run this program.
Step 4: Create a daily cron job for it by enter the command: “sudo ln -s /usr/local/bin/automysqlbackup /etc/cron.daily/”
The default location for backups is “/var/lib/automysqlbackup“. There are three child-folders inside it, daily | monthly | weekly, stored all backup files at the corresponding time interval.
Hopefully this guide will help you protect your site, no one knows what will happen in the future so we always have a backup plan for ourselves. Wish you success and do not forget to visit our digitalocean promo code page to get the most attractive promotions from DigitalOcean. Nice a day 🙂
1 Comment
Thanks for sharing this!
The next step to secure your backup would actually be to save it somewhere else than on your own server.
I wrote a post explaining just how to backup Mysql and store it to AWS S3 (I won’t share it here but you can find it on my signature).
I felt it might be a good complimentary article to yours covering how to backup your MySQL.
Thanks!