# MariaDB Here we capture some common actions To install Mariadb (as a container) see below and => topics/deploy/installation # Tags * type: info, documentation * keywords: mariadb, systems # Check the transaction logs Start the client and: ``` MariaDB [db_webqtl]> show binary logs; +-----------------------+-----------+ | Log_name | File_size | +-----------------------+-----------+ | gn0-binary-log.000012 | 374532448 | | gn0-binary-log.000013 | 933672549 | | gn0-binary-log.000014 | 12774545 | +-----------------------+-----------+ 3 rows in set (0.001 sec) ``` To get a log ``` mysql -p -u webqtlout db_webqtl -e "SHOW BINLOG EVENTS IN 'gn0-binary-log.000014';" ``` To get a log with some stuff filtered out try ``` mysql -p -u webqtlout db_webqtl -e "SHOW BINLOG EVENTS IN 'gn0-binary-log.000014';" -r -s |grep -v -e "Access\|GTID\|INSERT_ID\|COMMIT\|Temp\|lastlogin\|LITERA\|flush\|ROLLBACK" ``` # Update MariaDB to the latest production database using borg recovery The MariaDB instance needs to be periodically updated to the latest version of the database running on production. We do this by restoring backups of the production database into MariaDB database directory. Here's how. Backups are managed using Borg as the ibackup user. First, become the ibackup user. ``` me@penguin2$ sudo -su ibackup ``` Borg expects the passphrase in an environment variable. Set it by sourcing this shell script. ``` ibackup@penguin2$ . /home/ibackup/.borg-pass ``` Change directory to /export/backup/tux01 and list the backup archives. ``` ibackup@penguin2:/export/backup/tux01$ /home/wrk/opt/borg/bin/borg list borg-tux01/ ``` Stop the running mariadb-guix.service. Restore the latest backup archive and overwrite the existing database directory at /var/lib/mysql. Finally, restart the service. Note that /var/lib/mysql is actually a symbolic link to the real database directory at /export/mysql. => https://www.borgbackup.org/ Borg => https://borgbackup.readthedocs.io/en/stable/ Borg documentation #