Backing Up Your Scalingo for MySQL® Addon
Starter and Business plans of Scalingo for MySQL® include automated and managed backups so you don’t have to worry about them.
We use Periodic backups to create the automated ones. Manual backups are also available for these plans.
Please carefully read our backup policies for details about backups retention and important considerations regarding backups.
Understanding Periodic Backups
Periodic backups are done on a daily basis. They consist in dumping your database in an archive that we keep during a certain amount of time.
For Business plans, the backup is done on the secondary node to avoid any impact on your primary node.
Configuring Periodic Backups
By default, Periodic backups are done around 1:00 AM Central European Time (CET or UTC+0100). This time can be modified.
Using the Database Dashboard
- From your web browser, open your database dashboard
- Click the Backups tab
- Locate the Backup schedule block
- Click the Schedule button
- Make sure to check the I want to enable scheduled backups checkbox
- Pick an hour (timezone is UTC)
- Validate by clicking the Update button
Using the Command Line
- Make sure you have correctly setup the Scalingo command line tool
- Configure the time of backup:
- By setting an hour:
scalingo --app my-app --addon mysql backups-config --schedule-at 3
In this example, we ask the platform to create the backups at ~03:00.
Note: The timezone used is the local timezone of the machine running the command.
- By setting an hour and a timezone:
scalingo --app my-app --addon mysql backups-config --schedule-at "4:00 UTC"
In this example, we ask the platform to create the backup at ~04:00 UTC.
The output should look like this:
-----> Periodic backups will be done daily at 6:00 CET
- By setting an hour:
Downloading a Periodic Backup
Using the Database Dashboard
- From your web browser, open your database dashboard
- Click the Backups tab
- Locate the Backups block
- Locate the Periodic backup you are interested in
- Click the corresponding Download button
Using the Command Line
- Make sure you have correctly setup the Scalingo command line tool
- Run the following command(s):
- To download the latest backup available:
scalingo --app my-app --addon mysql backups-download
The output should look like this:
-----> Selected the most recent successful backup 139.37 KiB / 139.37 KiB [----------------------------------] 100.00% ? p/s ===> 20231207000608_my_app_4553.tar.gz
The backup is downloaded in your current working directory.
- To download a specific backup:
- List the backups available for this database addon:
scalingo --app my-app --addon mysql backups
The output should look like this:
+--------------------------+--------------------------------+--------+--------+ | ID | CREATED AT | SIZE | STATUS | +--------------------------+--------------------------------+--------+--------+ | 65710b0a99c3cd23d455edee | Thu, 07 Dec 2023 01:00:10 CET | 143 kB | done | | 656fb98b99c3cd23d455d4e7 | Wed, 06 Dec 2023 01:00:11 CET | 143 kB | done | | 656e680a99c3cd23d455c1f0 | Tue, 05 Dec 2023 01:00:10 CET | 143 kB | done | ...
- Locate the
ID
of the backup you want to download - Download the backup:
scalingo --app my-app --addon mysql backups-download --backup <backup_ID>
The output should look like this:
79.10 KiB / 79.10 KiB [---------------------------------] 100.00% ? p/s ===> 20230305000044_my_app_4553.tar.gz
The backup is downloaded in your current working directory.
- List the backups available for this database addon:
- To download the latest backup available:
Understanding Manual Backups
Manual backups use the exact same mechanism as Periodic backups, except that they are not automated. As the name suggests, Manual backups are triggered manually, whenever you want.
Creating a Manual Backup
Using the Database Dashboard
- From your web browser, open your database dashboard
- Click the Backups tab
- Locate the Backups block
- Click the Trigger manual backup button
Using the Command Line
- Make sure you have correctly setup the Scalingo command line tool
- Ask the platform to backup the database:
scalingo --app my-app --addon mysql backups-create
After a while, the output should look like this:
-----> Backup successfully finished
Downloading a Manual Backup
Please refer to Downloading a Periodic Backup section, as the process is exactly the same.
Dumping the Database
There are different ways to dump (and restore) a MySQL® database. We generally advise to either:
- Process from a one-off container
- Or conduct the operations from your workstation, by accessing the database in a secured manner
From a One-Off Container
This method doesn’t require to make your database reachable over Internet.
- Follow the procedure to access your MySQL® database from a one-off container
- Make sure to understand the connection URI
- Dump the database:
mysqldump --user=<user> --password=<password> --host=<host> --port=<port> --column-statistics=0 --no-tablespaces <dbname> > dump.sql
With
user
,password
,host
,port
anddbname
from your original connection URI.
From Your Workstation
- Open a DB tunnel so you can access your database from your workstation
- Make sure to understand the connection URI
- Dump the database using the
mysqldump
command (you may have to install it):mysqldump --user=<user> --password=<password> --host=127.0.0.1 --port=<port> --column-statistics=0 --no-tablespaces <dbname> > dump.sql
With
user
,password
anddbname
from your original connection URI andport
depending on what you did (default is10000
)