GithubHelp home page GithubHelp logo

osshelp / backup-functions Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 2.0 99 KB

Library for common backup functions and tasks

License: GNU General Public License v3.0

Shell 100.00%
backup backup-script mysql-backup postgresql-backup mongodb-backup redis-backup consul-backup gitlab-backup shell-scripting backup-scripts

backup-functions's Introduction

backup-functions

Build Status

About

This library is used for backup purposes.

Supported software:

  • MySQL
  • PostgreSQL
  • MongoDB
  • Redis
  • Elasticsearch
  • Clickhouse
  • RabbitMQ
  • SQLite
  • Consul
  • Gitab
  • Files and directories

Upload to a remote storage:

So, you can use the following protocols:

  • FTP/SFTP/LFTP
  • rsync
  • AWS S3 (or any S3-compatible)
  • OpenStack Swift
  • Backblaze B2
  • DigitalOcean Spaces
  • Dropbox
  • Google Cloud Storage
  • Google Drive
  • Microsoft Azure Blob Storage
  • Microsoft OneDrive
  • WebDAV
  • Yandex Disk

It also supports:

  • Compressing (zip, bzip2, pbzip2)
  • Encryption
  • Files splitting

How to use it

NOTE: If you want to send backup metrics to Pushgateway in version 4.x.x, you need to install pushgateway-functions.

The library must be included in the backup scripts. In the examples folder you can find examples based on backup-functions/custom.backup template.

How to use the library:

  1. Place backup-functions.sh library in the /usr/local/include/osshelp/ path
  2. Make a backup script from the template /usr/local/sbin/custom.backup or from examples (or use your own ideas)
  3. Run your script and check the results of it works (are there any errors?)
  4. Add script to Cron job with needed schedule
  5. Make sure that the script works as you expected by schedule

There’re install/update scripts in the repository. Command for installation (backup-function.sh, custom.backup template and logrotate config):

curl -s https://oss.help/scripts/backup/backup-functions/install.sh | bash

Or you can use this Ansible role to install it.

If you need, you can run the custom.backup template by hands with following keys:

  • -b or --backup -- runs only make_backup function
  • -u or --upload -- runs only upload_backup function

This is functionality of main function. If you run custom.backup without keys it runs both functions (make_backup and upload_backup).

FAQ

Metrics were not sent to pushgateway. What is it and how to disable it?

By default this library tries to send metrics to local Pushgateway service. If you want to disable Pushgateway usage, you can add no_pushgateway=1 to the options section in the script.

Default backup scheme and how can I change it?

Default backup scheme:

  • 1 local copy in the /backup folder
  • 7 daily copies in the storage
  • 4 weekly copies in the storage
  • 3 monthly copies in the storage

You can override it by this variables in the script:

  • local_days -- how many days local copy must be kept
  • remote_backups_daily -- how many daily copies you need in storage
  • remote_backups_weekly -- how many weekly copies you need in storage
  • remote_backups_monthly -- how many monthly copies you need in storage

In the local backup folder one more copy than I setted. What's wrong?

That happened because of local copies being cleaned before making a new backup. So if you set the variable local days=2 you can see 2 copies remain after cleaning + one new copy (3 local copies total).

Author

OSSHelp Team, see https://oss.help

backup-functions's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

olrele qx10

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.