Skip to main content

Understand Aiven for MySQL® backups

Aiven for MySQL databases are automatically backed-up, with full backups daily, and binary logs recorded continuously. The number of stored backups and the retention time depend on your service plan. For the exact figures, see Backup retention. Full backups are version-specific binary backups, which when combined with binlog allow for consistent recovery to a specific point in time (PITR).

important

One thing to consider is that you may modify the backup time configuration option in Advanced configuration in Aiven Console which will begin shifting the backup schedule to the new time. If there was a recent backup taken, it may take another backup cycle before it starts applying new backup time.

note

To be able to safely make backups, MySQL INSTANT ALTER TABLE always use the INPLACE or COPY algorithm instead of INSTANT. Specifying ALGORITHM=INSTANT does not fail but automatically falls back to INPLACE or COPY as needed.

Backup retention​

Full backups​

Aiven takes a backup of your service every 24 hours. It is a full backup unless you enable incremental backups. Your service plan defines how many backups Aiven stores, and therefore how far back you can restore. As new backups are taken, the oldest ones are removed. For the backup history of each plan, see High availability of Aiven for MySQL®.

Binary logs​

Aiven uploads binary logs to backup storage continuously and keeps them as long as the backup they belong to. Your plan decides how far back you can restore.

Binary log retention on the service disk​

The binlog_retention_period advanced parameter sets how long binary log files stay on your service's disk after they are backed up. It exists for tools that read binary logs from the server, such as Debezium. It does not change how far back you can restore.

When the parameter is not set, binary logs stay on the disk for 600 seconds. The shortest retention you can set is 600 seconds. By default, the longest retention you can set is 86400 seconds (24 hours). To keep binary logs for up to 1814400 seconds (21 days), contact Aiven support. If your service has enough disk space for the additional binary logs, Aiven raises the limit for the whole project.

Longer binary log retention uses more disk space on your service. Review your disk usage before you increase the retention period. See Prevent a full disk.

warning

Reducing binlog_retention_period can make a large batch of binary logs eligible for purge at once. Depending on the volume, this can stall the MySQL commit path and block writes until the purge completes. Lower the value gradually, in small decrements, during a low-traffic window.

To set binlog_retention_period, see binlog_retention_period in the advanced parameters reference.

MySQL backups and encryption​

All Aiven for MySQL backups use the myhoard software to perform encryption. Myhoard utilizes Percona XtraBackup internally for taking a full (or incremental) snapshot of MySQL.

Since Percona XtraBackup 8.0.23 the --lock-ddl option is enabled by default. This ensures that DDL changes cannot be performed while a full backup process is ongoing. This is important to guarantee that the backup service is consistent and can be reliably used for restoration.

With this feature enabled, if you try to run CREATE, ALTER, DROP, TRUNCATE or another command during backup, you may receive the message Waiting for backup lock. In this case, wait till the backup is complete for running such operations.

Configure the backup schedule​

Set the time of day when the daily backup is taken.

To edit the backup schedule for your service:

  1. In your service, click Backups.
  2. Click Actions > Configure backup settings.
  3. Click Add configuration options.
  4. Add backup_hour and backup_minute, and set their values.
  5. Click Save configuration.

If a backup was recently made, it can take another backup cycle before the new backup time takes effect.

Related pages