Document MariaDB backup and restore procedures
This commit is contained in:
1 parent
072207ed4e
commit
c158a6e863
2 files changed
+43
-1
No files matched your search
+39
-1
@@ -157,11 +157,49 @@ message when the installation needs attention.
|
||||
| --- | --- | --- |
|
||||
| `configured` | 0 | All checks passed. |
|
||||
| `not_installed` | 2 | The registry, database, and login are absent. |
|
||||
| `needs_attention` | 2 | An installation is incomplete or differs from the expected configuration. |
|
||||
| `needs_attention` | 2 | Provisioning or restore is incomplete, or the installation differs from the expected configuration. |
|
||||
|
||||
Exit code `1` indicates an invalid manifest or an unavailable check, for example
|
||||
when the MariaDB administrative connection fails.
|
||||
|
||||
### Back up and restore a managed database
|
||||
|
||||
Run these commands as root on the MariaDB node. Install the MariaDB client
|
||||
utilities and the Coulobre package with its `mariadb` extra. Use the same
|
||||
database manifest and socket as for provisioning. Add `--socket PATH` when
|
||||
using a custom socket.
|
||||
|
||||
```sh
|
||||
sudo install -d -m 0700 /var/backups/coulobre
|
||||
sudo /opt/coulobre/bin/coulobre-database-node backup-database \
|
||||
coulobre-database-1.json /var/backups/coulobre/database-1.sql.gz
|
||||
```
|
||||
|
||||
The node writes a gzip-compressed SQL dump containing the database's schema,
|
||||
rows, views, triggers, routines, and events. Database objects with a definer
|
||||
must use the managed application login. The dump uses a single transaction
|
||||
for InnoDB data. Pause schema changes and writes to nontransactional tables
|
||||
during backup. Choose a new filename for each backup and keep archives in a
|
||||
root-controlled directory with file permissions of `0600`.
|
||||
|
||||
To restore, apply the original manifest on the destination node and leave the
|
||||
new database empty. Transfer the archive to a root-controlled directory on that
|
||||
node and ensure it is owned by root with permissions of `0600`.
|
||||
|
||||
```sh
|
||||
sudo /opt/coulobre/bin/coulobre-database-node restore-database \
|
||||
coulobre-database-1.json /var/backups/coulobre/database-1.sql.gz
|
||||
```
|
||||
|
||||
The node checks the gzip stream and its database identity before running the
|
||||
SQL. The archive needs temporary space for the uncompressed SQL on the same
|
||||
filesystem. Use the destination node's application credentials and keep the
|
||||
application disconnected until the restore completes.
|
||||
|
||||
MariaDB can commit schema changes before reporting a restore error. If an
|
||||
import fails, `status` reports `needs_attention`. Inspect the partial database
|
||||
and return it to an empty state before retrying with the same manifest.
|
||||
|
||||
### Enable local database provisioning
|
||||
|
||||
On a MariaDB node using `/run/mysqld/mysqld.sock`, install the matching Coulobre
|
||||
|
||||
Reference in new issue
Block a user