GithubHelp home page GithubHelp logo

rakib32 / go-dumper Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 17.91 MB

This is a DB dump tool which will dump data from the source database, then will upload it to GS or AWS bucket and finally will restore the data to destination database

License: Apache License 2.0

Shell 7.31% Go 91.84% Dockerfile 0.84%
go golang database-backup production-backup dumper import staging-load mysql data-dump cronjob

go-dumper's Introduction

go-dumper

It's a DB dump tool which will create a backup from source database, then will zip the backup file and upload it to GCS or AWS bucket, finally will restore the data to destination server.

  • Creates backup form production database
  • Loads backup sql file to staging database

Options

  • Usage: dumper [command]

  • Available Commands:

    • dump Creates backup form production database
    • load Loads backup sql file to staging database
  • Flags:

    • --create-database Create new schema to target DB. Format will be like: dbname_20180101
    • --delete-dump-files Delete Dump files .sql and .tar
    • dump
      • --skip-bucket-store It will ignore bucket storing
      • --skip-restore Only backup will be created
    • load
      • --dump-path It can be either local filepath or GS bucket path

Settings

  • To run tool:

    • Run dumper via run.sh:
      • ./run.sh
      • ./run.sh prod [for production]
  • To run dumper as a CronJob in kubernets cluster(Production)

    • Update deploy/cronjob.yaml file with your desired time to run
    • Apply the above changes using following command: kubectl apply -f cronjob.yaml
    • Other userful commands
      • kubectl get pods
      • kubectl describe pod
      • kubectl delete jobs --all

Database Support

DB Name Supported
Mysql
Postgres
Sql Server

Notes:

  • important please use mysql client 8.0 or higher to avoid time out issues for large datbase
  • used viper to import config.
  • used logrus to print logs
    • logrus is completely api-compatible with the stdlib logger, so you can replace your log imports everywhere with log "github.com/sirupsen/logrus"

go-dumper's People

Contributors

rakib32 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  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.