Giter Site home page Giter Site logo

mysql-azure-backup's Introduction

MySQL backup (dump) and sync to Azure Blob Storage

This is a simple service that uses mysqldump to dump a list of databases and then uploads the files to an Azure Container (Blob Storage). This is a work in progress, currently backups are performed every hour at minute zero.

Based on Python's official Docker image (tag: 3.8.3-alpine).

Requirements

  • An Azure subscription with a Storage Account already setup and an existing container named mysql on it. See Microsoft's official documentation for indications. You need the AZURE_STORAGE_CONNECTION_STRING for the Docker container.

  • A MySQL Server with read access to the databases you want to back up, I strongly suggest using read only grants.

  • Docker.

Environment variables

  • MYSQL_HOST: the MySQL server you want to back up, defaults to 127.0.0.1.

  • MYSQL_PORT: the MySQL server port, defaults to 3306.

  • MYSQL_DATABASES: list of databases you want to back up. This is parsed as a list, example: db1 db2 db3, so, for example MYSQL_DATABASES='db1 db2 db3'.

  • MYSQL_USER: MySQL user to connect to MySQL server.

  • MYSQL_PASSWORD: MySQL user password to connect to MySQL.

  • AZURE_STORAGE_CONNECTION_STRING: string used to connect to Azure's Blob Storage, please read Microsoft's official documentation on the topic.

How to

$ docker pull mdlee/mysql-azure-backup

# In this case I have AZURE_STORAGE_CONNECTION_STRING already setup in my environment
$ docker run -it --rm -e "MYSQL_DATABASES='testing'" -e "AZURE_STORAGE_CONNECTION_STRING=$AZURE_STORAGE_CONNECTION_STRING" -e 'MYSQL_USER=mysql' -e 'MYSQL_PASSWORD=mySecret1234' mysql-backup

TODO

  • Use unix socket to connect to MySQL.

  • Create Storage Account/Container if required.

  • Allow customizable schedule.

  • Use Docker secrets for variables.

mysql-azure-backup's People

Contributors

alvaro-gh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.