Giter Site home page Giter Site logo

mongobackup's Introduction

Description

This script will take a mongodump of the specified mongodb database. It will then copy the dump to an s3 bucket. It will also send a status update for when the script is ran to the room that is connected to the SLACKURI that you provide. Be sure to run this script as root.

Usage

  1. Install awscli. - apt-get install awscli
  2. Create an s3 bucket. - Add a lifecycle rule to expire files after a specified time.
  3. Create a user that has access to add files to s3 bucket.
  4. Configure awscli with a user with access to your s3 bucket. - aws configure
  5. Add the environment to the ENVIRONMENT variable in script.
  6. Add the prefix you want in the S3PREFIX variable.
  7. Add the name of your s3 bucket in the BUCKET variable.
  8. Create a new webhook in your slack and assign it to a channel you want to receive alerts on. Add the webhook URL to the BUCKET variable.
  9. Make the script executable. - chmod +x /path/to/script/mongobackup.sh
  10. Setup a cron with crontab -e to a backup period you want. For example, if you want this script to run everynight at 11pm, set your cron settings to 0 23 * * * /path/to/script/mongobackup.sh. If you want to have the scripts log to a file when it runs then do 0 23 * * * /path/to/script/mongobackup.sh >> /path/to/log/logfile.log 2>&1. You will need to make sure the directory you want to store the log file in exists already.

Requirements

awscli

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.