simple mysql backup container creates a backup file for every available database on a mysql server
785
!!! Use https://github.com/appuio/mariadb-backup-cronjob instead!!!
Before executing the following commands make sure that you are logged into Openshift via the commandline (oc login) and using the correct project (oc project). The mysql service doesn't have to be located in the same project, if you can access it remotely.
$ oc new-app https://github.com/appuio/mysql-multidb-backup-container.git --strategy=docker
$ oc env dc mysql-multidb-backup-container -e MYSQL_ROOT_USER=user -e MYSQL_ROOT_PASSWORD=pw -e MYSQL_SERVICE_HOST=mysql -e BACKUP_DATA_DIR=/tmp/ -e BACKUP_KEEP=5 -e BACKUP_MINUTE=10 -e BACKUP_HOUR=11
Note: For values with comma (eg. 11,23) you will have to edit the dc with vim: oc edit dc mysql-multidb-backup-container
$ oc get pods
$ oc rsh mysql-simple-backup-container-#-#####
$ gunzip < /opt/app-root/backup/$MYDB/dump-yyyy-mm-dd-hh-mm.sql.gz | mysql -h $MYSQL_SERVICE_HOST -u $MYSQL_USER -p$MYSQL_PASSWORD $MYDB
If you have a few projects that require mysql backups it makes sense to have a central build. The following command only builds the image in the openshift namespace.
Create the central image build
$ oc new-app -f template-build.json -n openshift
Since the image is already built, you can now deploy it multiple times in different projects and reference the same build. This allows you to update one central build and trigger multiple redeploys. Make sure you are in the correct project and run the following command.
$ oc new-app -f template-persistent.json -p MYSQL_ROOT_USER=user -p MYSQL_ROOT_PASSWORD=pw -p BACKUP_VOLUME_CAPACITY=2Gi
set the following Envs
Content type
Image
Digest
Size
237.7 MB
Last updated
over 9 years ago
docker pull appuio/mysql-multidb-backup-container