From 01990670c98096016c691b131e91dc42937197e7 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Fri, 5 Feb 2021 14:05:24 +1100 Subject: [PATCH] translate: backup zanata db directly to borg As noted inline, a recent mysql client update has broken the "--all-databases" flag, at least for the client version and very old server version we use. Emperically, dumping individual databases still works with this client. Switch this to stream the db directly into borg. Ignore the old backups and remove the bup backup while we are here, since this is all borg now. Change-Id: I5fe762a003ce2c2ba4830367be87598f67f7e763 --- inventory/service/group_vars/translate.yaml | 3 +++ .../openstack_project/manifests/translate.pp | 26 ++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 inventory/service/group_vars/translate.yaml diff --git a/inventory/service/group_vars/translate.yaml b/inventory/service/group_vars/translate.yaml new file mode 100644 index 0000000000..0f98162313 --- /dev/null +++ b/inventory/service/group_vars/translate.yaml @@ -0,0 +1,3 @@ +borg_backup_excludes: + # backed up via streaming + - '/var/backups/mysql_backups*' diff --git a/modules/openstack_project/manifests/translate.pp b/modules/openstack_project/manifests/translate.pp index 030cb2c4fd..5a35ab76fb 100644 --- a/modules/openstack_project/manifests/translate.pp +++ b/modules/openstack_project/manifests/translate.pp @@ -130,6 +130,12 @@ class openstack_project::translate( require => Exec['register-zanata-projects'], } + # NOTE(ianw) 2021-02-05 : the --all-databases option to mysqldump + # this sets up appears to not be dumping all databases since a + # recent upgrade; see + # https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1914695 + # This effectively makes this dump useless. Below we are streaming + # the database directly into borg, which does still work. mysql_backup::backup_remote { 'translate': database_host => $mysql_host, database_user => $mysql_user, @@ -138,9 +144,21 @@ class openstack_project::translate( require => Class['zanata'], } - include bup - bup::site { 'ord.rax': - backup_user => 'bup-translate', - backup_server => 'backup01.ord.rax.ci.openstack.org', + # Streaming backup of zanata db; see borg-backup role + file { '/etc/borg-streams': + ensure => directory, + owner => 'root', + group => 'root', + mode => '0755', } + + file { '/etc/borg-streams/mysql': + ensure => file, + owner => 'root', + group => 'root', + mode => '0755', + content => '/usr/bin/mysqldump --defaults-file=/root/.translate_db.cnf --ignore-table mysql.event --skip-extended-insert --single-transaction zanata', + require => File['/etc/borg-streams'], + } + }