Upgrade MariaDB (v11.4.2-1 -> v11.4.2-2) and document upgrading functionality

This commit is contained in:
Slavi Pantaleev 2024-06-07 17:44:35 +03:00
parent 9eaa961035
commit 350e207154
2 changed files with 28 additions and 3 deletions

View file

@ -30,7 +30,8 @@ mariadb_root_passsword: ''
########################################################################
```
### Getting a database terminal
## Getting a database terminal
You can use the `/mash/mariadb/bin/cli` tool to get interactive terminal access to the MariaDB server.
@ -43,11 +44,35 @@ You can then proceed to write queries. Example: `SELECT COUNT(*) FROM users;`
**Be careful**. Modifying the database directly (especially as services are running) is dangerous and may lead to irreversible database corruption.
When in doubt, consider [making a backup](#backing-up-mariadb).
## Upgrading MariaDB
The major MariaDB version you start with (e.g. `10.10` or `10.11`) will be kept until you manually upgrade it. The playbook will stick to this major version and only do minor version upgrades (e.g. `10.10.1` -> `10.10.3`).
For now, there's no automatic upgrade path between major MariaDB versions, but support for upgrading will be added in the future.
This is because newer MariaDB versions cannot start with data generated by older MariaDB versions.
Upgrades must be performed manually.
This playbook can upgrade your existing MariaDB setup with the following command:
```sh
just run-tags upgrade-mariadb
```
**The old MariaDB data directory is backed up** automatically, by renaming it to `/mash/mariadb/data-auto-upgrade-backup`.
To rename to a different path, pass some extra flags to the command above, like this: `--extra-vars="mariadb_auto_upgrade_backup_data_path=/another/disk/mash-postgres-before-upgrade"`
The auto-upgrade-backup directory stays around forever, until you **manually decide to delete it**.
As part of the upgrade, the database is dumped to `/tmp`, an upgraded and empty MariaDB server is started, and then the dump is restored into the new server.
To use a different directory for the dump, pass some extra flags to the command above, like this: `--extra-vars="mariadb_dump_dir=/directory/to/dump/here"`
To save disk space in `/tmp`, the dump file is gzipped on the fly at the expense of CPU usage.
If you have plenty of space in `/tmp` and would rather avoid gzipping, you can explicitly pass a dump filename which doesn't end in `.gz`.
Example: `--extra-vars="mariadb_dump_name=mash-postgres-dump.sql"`
**All databases, users, etc. on the MariaDB server are migrated**.
## Backing up MariaDB

View file

@ -181,7 +181,7 @@
name: loki
activation_prefix: loki_
- src: git+https://github.com/mother-of-all-self-hosting/ansible-role-mariadb.git
version: v11.4.2-1
version: v11.4.2-2
name: mariadb
activation_prefix: mariadb_
- src: git+https://gitlab.com/etke.cc/roles/miniflux.git