/go/maria backs up every MariaDB database on the server at once, using mariadb-backup and restic. It: This command backs up the database server only. For hosting accounts (files, mail, settings), use backup or snapshot. Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.
Quick start
# 1. Turn on scheduled backups (creates /var/go/etc/maria.conf)
/go/maria start
# 2. Take a backup now
/go/maria
# 3. See your snapshots
/go/maria list
Options
Actions and flags
| Argument | Used with | Default | Notes |
|---|---|---|---|
start |
— | — | Does nothing if maria.conf already exists. |
stop |
— | — | Replaces any earlier maria.bak. |
list |
— | — | Same as restic snapshots on the destination. |
refresh |
— | — | Forces a new full backup. The local backup chain is deleted first. |
restore |
— | — | Fails if /var/lib/mysql already contains data, unless you pass --force. |
connect |
— | — | Erases the data directory of the earlier connect instance and ends anything listening on port 3307. |
<snapshot> |
restore, connect |
Backup files already in Dir |
A tag or snapshot ID. If omitted, the backup files already on disk are used. |
--force |
restore |
Off | Stops MariaDB and deletes everything in /var/lib/mysql before restoring. |
Settings file: /var/go/etc/maria.conf
All backup actions need this file. start creates it.
| Setting | Default | Notes |
|---|---|---|
Cron |
"0 12,16,20 * * *" |
Written by start. Backups run at 12:00, 16:00, and 20:00 daily. The script itself does not read this value. |
Dir |
/maria |
Local working folder for the backup files. If you set it, the folder must already exist. |
RemoteDir |
maria |
Folder in the remote destination. A leading / is removed. |
Example:
Cron="0 12,16,20 * * *"
Dir="/maria"
RemoteDir="maria"
Backup destination
The destination is chosen automatically from /root/.config/rclone/rclone.conf:
| rclone remote found | Destination |
|---|---|
[maria] |
maria:<RemoteDir>/<hostname> |
[backup] (and no [maria]) |
backup:<RemoteDir>/<hostname> |
| Neither | /backup/maria on this server (no hostname subfolder) |
Examples
# Take a backup (full the first time, incremental afterwards)
/go/maria
# Start over with a fresh full backup, for example after switching destination
/go/maria refresh
# List the available snapshots
/go/maria list
# Restore the latest snapshot taken at 20:00 over the live databases
/go/maria restore 20 --force
# Restore a specific snapshot by its ID
/go/maria restore a1b2c3d4 --force
# Inspect the 12:00 snapshot without touching live data
/go/maria connect 12
mariadb --port=3307
# Stop scheduled backups
/go/maria stop
Output
The command prints short progress lines. There is no JSON output.
| Message | Meaning |
|---|---|
Taking Full Backup... |
No full backup exists locally, so one is being taken. |
Restic Full Backup: <destination>... |
The full backup is being sent to the destination. |
Taking Incremental Backup... |
A full backup already exists, so only changes since it are being taken. |
Restic Incremental Backup: <destination>... |
The incremental backup is being sent to the destination. |
Restoring Restic TAG <tag>... |
The snapshot argument matched a tag. |
Restoring Restic ID <id>... |
The snapshot argument matched a snapshot ID. |
Restoring MariaDB Backup... |
The backup files are being prepared and copied back. |
mariadb --port=3307 |
Printed by connect. Run it to open the second instance. |
Instance (maria) already running. |
Another run started less than an hour ago. |
Invalid Server Hostname <hostname>, ... |
The hostname has fewer than two dots. |
File /var/go/etc/maria.conf not Exists. |
Scheduled backups were never started (or were stopped). |
Folder <Dir> not Exists. |
Dir in maria.conf points to a missing folder. |
Directory /var/lib/mysql is not empty. |
restore refused to overwrite existing data. |
Archive <snapshot> does not exist |
No tag or ID matched. The snapshot list is printed after it. |
[!NOTE]
Most actions end with exit status1, even when they work (start,stop,list,restore,connect, and full backups). Only an incremental backup ends with0. In scripts, read the output instead of relying on the exit status.
Security
[!WARNING]
Restic encrypts snapshots with a fixed password built into the script. That password is the same on every server, so the encryption does not protect your data from anyone who can read the repository and knows the default. Restrict access to the remote bucket or to/backup/maria. The MariaDB root password is also passed tomariadb-backupon its command line, so it is briefly visible in the process list while a backup runs.
See the full reference at /go/maria and the GoAdmio command index.
GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.
