GithubHelp home page GithubHelp logo

sapcc / maria-back-me-up Goto Github PK

View Code? Open in Web Editor NEW
15.0 36.0 0.0 12.56 MB

Mariadb incremental backup and restore tool for k8s

License: Apache License 2.0

Go 89.71% Dockerfile 0.59% Makefile 1.00% HTML 4.49% CSS 0.20% JavaScript 2.73% Shell 1.28%
mariadb backup k8s database restore incremental-backups binlog swift s3-storage

maria-back-me-up's Introduction

maria-back-me-up

MariaDB backup tool

Features

List of features currently available:

  • Full dump via MyDumper or mysqldump (invertal can be configured)
  • Incremental backups via binlog (invertal can be configured)
  • Supported backup storage
    • S3
    • Swift
    • Disk
  • Automatic verification of existing backups (can be run as separate service)
  • UI to see and select an available backup to restore to
  • UI shows status of backup verification
  • UI/API can be secured via OAuth openID
  • Replication of full dump and binlog events to another MariaDB
    • only QueryEvents are supported
    • restore from this replicas MariaDB is not supported
    • verification of this replica is not supported

Architecture

maria-backup

UI

The UI is available via localhost:8081/ It shows a list of available full backups in S3. Any full backup contains 1 or more incremental backups, which can be selected to perform a complete restore!
The color of an incremental backups shows the state of the backup verification:\

# backup verfication not yet executed
- backup verfication failed
! Backup verfication partly succeeded. A restore was successful, however the table checksum failed
+ backup verfication successful. A restore is save to perform!

Full logical backups

Are done either via the mysql_dump (default) or the MyDumper tool. MyDumper can use multiple threads to dump and restore tables, makes it therefore suitable for databases with a huge number of tables.

full_dump_tool=mysqldump/mydumper

Incremental backups via binlogs

This backup tool uses binlogs to make incremental backups.
Therefore the binlog needs to be enabled in the MariaDB config

log-bin=bin.log      # Binlog folder and name
binlog_format=MIXED  # Formant, described below
expire_logs_days=3   # After x days binlog files get purged. Important! Otherwise volume could be filling up fast
server_id=1          # Unique server id. Used for replication

Binlog

The tool acts like a replication slave and receives all the binlog events. This allows it to check if any real changes have been made to the database.
If no changes have been detected, no incremental backup will be created and saved to S3.

Binlog Format

By default MariaDB will use the MIXED format (since 10.2.4). It is a mix of ROW and STATEMENT.
ROW will capture the actual change made to a table. The binlog files therefor can get very large.
e.g. an update to a table column of 1000 rows will create 1000 row changes. With STATEMENT only the update statement will be recorded in the binlog.

Config

service_name: # Name of your MariaDB (also used as the s3 folder name)
namespace: # k8s namespace name
sidecar: # boolean
backup:
  full_backup_interval_in_hours: # Interval for full MariaDB dumps in hours
  incremental_backup_interval_in_minutes: # Interval for saving incremental backups, one continous increment if < 0
  purge_binlog_after_minutes: # if > 0 binlog files are kept on the primary db until they are older
  enable_init_restore: # Enables a automatic restore if one of the databases (in MariaDB.databases) are missing.
  enable_restore_on_db_failure: # Enables automatic restore if the db is unhealthy.\
  disable_binlog_purge_on_rotate: # Boolean to disable binlog purging. Purging is enabled by detault
  binlog_max_reconnect_attempts: # Number of reconnect attempts by the binlog syncer, default is 10
  outh:
    enabled: # enables OAuth to access the API (openID)\
    provider_url: # Url of the openID provider (e.g. Dex)\
    redirect_url: # OAuth redirect url (this is the url of your mariabackup service)\
database: # database config
    type: # either 'mariadb' or 'postgres'
    version: # MariaDB version e.g.: "10.4.0"
    full_dump_tool:
    log_name_format: # prefix of the binlog files
    user: # user with admin rights (to drop and restart MariaDB)
    password: # user password
    host: # host of the MariaDB instance. If running as a sidecar within the MariaDB pod: 127.0.0.1
    port: # MariaDB port number
    server_id: # server_uuid/server_id of the binlog syncer connecting to the host
    data_dir: # data directory of the MariaDB instance
    databases: # list of databases (used for health checks and restores)
      - database_name
      - ...
    verify_tables: # list of tables for the backup verification check. If none are provided the checksum verification is skipped!
      - database_name.table_name
      - ...
storages:
  s3:
    - name: # name of the storage
      aws_access_key_id: # s3 access key
      aws_secret_access_key: # s3 secret access key
      aws_endpoint:
      sse_customer_algorithm:
      s3_force_path_style:
      sse_customer_key:
      region: # s3 region
      bucket_name: # bucket name to save the backup to
  swift:
    - name: # name of the storage
      auth_version: # OpenStack auth version
      auth_url: # OpenStack auth url (keystone url)
      user_name: # os user name
      user_domain_name: # os user domain name
      project_name: # os project name
      project_domain_name: # os project domain name
      password: # os password
      region: # region name
      container_name: # name of the container the backups should be store in
      chunk_size: # default 200mb
      slo_size: # default 600mb
  maria_db:
    - name: # name of the storage
      host: # host of the MariaDB instance
      port: # MariaDB port number
      user: # MariaDB user with admin rights
      password: # user password
      full_dump_tool: # dump tool used to restore the full dump
      databases: # if specified, only the listed databases are replicated
      parse_schema: # if true, the schema is parsed from the SQL Statement of a QueryEvent
      dump_filter_buffer_size_mb: # buffer used for reading from dump, default 2mb
  disk:
    - name: # name of the storage
      base_path: # root folder for the backups
      retention: # backup retention in number of full backups
verification:
  interval_in_minutes: # how often are the backups verified

maria-back-me-up's People

Contributors

carthaca avatar fwiesel avatar ivogoman avatar majewsky avatar renovate[bot] avatar stefanhipfel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

maria-back-me-up's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Error obtaining docker token

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • Update module github.com/DATA-DOG/go-sqlmock to v1.5.2
  • Update dependency popper.js to v1.16.1
  • Update module github.com/aws/aws-sdk-go to v1.52.4
  • Update module github.com/prometheus/client_golang to v1.19.0
  • Update module github.com/sirupsen/logrus to v1.9.3
  • Update module golang.org/x/oauth2 to v0.20.0
  • Update module golang.org/x/sync to v0.7.0
  • Update module golang.org/x/sys to v0.20.0
  • Update dependency popper.js to v2
  • Update mariadb Docker tag to v11
  • Update module github.com/docker/engine to v1
  • Update module github.com/ncw/swift to v2
  • Update module gopkg.in/yaml.v2 to v3
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.


Warning

Renovate failed to look up the following dependencies: Failed to look up docker package keppel.eu-de-1.cloud.sap/ccloud-dockerhub-mirror/library/golang, Failed to look up docker package keppel.eu-de-1.cloud.sap/ccloud-dockerhub-mirror/library/alpine, Could not determine new digest for update (go package github.com/pingcap/parser).

Files affected: Dockerfile, go.mod


Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

docker-compose
docker-compose.yaml
  • mariadb 10.4.12
  • mariadb 10.4.12
dockerfile
Dockerfile
  • keppel.eu-de-1.cloud.sap/ccloud-dockerhub-mirror/library/golang 1.17-alpine
  • keppel.eu-de-1.cloud.sap/ccloud-dockerhub-mirror/library/alpine 3.15.9
gomod
go.mod
  • go 1.17
  • github.com/DATA-DOG/go-sqlmock v1.5.0
  • github.com/aws/aws-sdk-go v1.34.0
  • github.com/coreos/go-oidc v2.1.0+incompatible
  • github.com/go-mysql-org/go-mysql v1.4.0
  • github.com/go-sql-driver/mysql v1.5.0
  • github.com/gorilla/sessions v1.2.0
  • github.com/hashicorp/go-multierror v1.0.0
  • github.com/labstack/echo v3.3.10+incompatible
  • github.com/namsral/flag v1.7.4-pre
  • github.com/ncw/swift v1.0.50
  • github.com/pingcap/errors v0.11.5-0.20201126102027-b0a155152ca3@b0a155152ca3
  • github.com/pingcap/parser v0.0.0-20210415081931-48e7f467fd74@48e7f467fd74
  • github.com/pkg/errors v0.9.1
  • github.com/prometheus/client_golang v1.16.0
  • github.com/robfig/cron/v3 v3.0.1
  • github.com/sirupsen/logrus v1.6.0
  • golang.org/x/net v0.7.0
  • golang.org/x/oauth2 v0.5.0
  • golang.org/x/sync v0.2.0
  • golang.org/x/sys v0.9.1-0.20230616193735-e0c3b6e6ae3b@e0c3b6e6ae3b
  • gopkg.in/yaml.v2 v2.4.0
  • k8s.io/api v0.23.5
  • k8s.io/apimachinery v0.23.5
  • k8s.io/client-go v0.23.5
  • github.com/docker/engine v0.0.0-20190717161051-705d9623b7c1@705d9623b7c1
html
static/html/templates/backup.html
  • popper.js 1.14.7@sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1
static/html/templates/index.html
  • popper.js 1.14.7@sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1
static/html/templates/restore.html
  • popper.js 1.14.7@sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1

  • Check this box to trigger a request for Renovate to run again on this repository

Keep latest backup forever

Make sure that the latest successful backup is kept "forever", that in an event without successful backups for a very long time we still have one good backup left!

Local / non-k8s use case?

Can this maria backup program work outside of a k8s environment at all?

It has pretty much all the mariadb backup features I'm looking for, except for the k8s part, which I do realize is a core part of the use case it's designed for.

So I think the answer is probably no, but thought it would be worth asking anyway. Thanks.

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.