Giter Site home page Giter Site logo

omasz / cassback Goto Github PK

View Code? Open in Web Editor NEW

This project forked from amorton/cassback

0.0 1.0 0.0 366 KB

Backup tool for Apache Cassandra based on https://github.com/synack/tablesnap

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%

cassback's Introduction

cassback

Tool for backing up and restoring Cassandra nodes. Based on the work by https://github.com/synack/tablesnap

Theory of Operation

Like Tablesnap, cassback watches for changes to the Cassandra data directory. cassback uses the cross platform watchdog package to watch for new, renamed and deleted files.

New, non temporary, files are queued for uploading by an endpoint such as S3 or local disk copy. When a new file is noticed for a Keyspace, or when one is deleted, the manifest of components for the keyspace is updated and stored.

Endpoints are used by Commands and provide an abstraction to store and retrieve files to different locations.

Installation

cassback provides a Python installer and installs dependencies and registers the cassback script.

It can be installed by running

python setup.py install

Or using pip

pip install cassback/

For now you also need to create the logging dir /var/log/cassback.

Configuration

Configuration is via the command line and supports reading a file for command line options.

The command line provides help for all available commands.

$ cassback help
usage: cassback [-h] [--survey-path SURVEY_PATH] [--meta-dir META_DIR]
                 [--aws-key AWS_KEY] [--aws-secret AWS_SECRET]
                 [--bucket-name BUCKET_NAME] [--key-prefix KEY_PREFIX]
                 [--max-upload-size-mb MAX_UPLOAD_SIZE_MB]
                 [--multipart-chunk-size-mb MULTIPART_CHUNK_SIZE_MB]
                 [--retries RETRIES] [--backup-base BACKUP_BASE]
                 [--endpoint {survey,s3,local}]
                 [--cassandra-version CASSANDRA_VERSION]
                 [--log-level {FATAL,CRITICAL,ERROR,WARN,INFO,DEBUG}]
                 [--log-file LOG_FILE]
                 {restore,help,show,list,purge,survey-report,validate,backup}
                 ...

cassback - snap, slurp, purge

optional arguments:
  -h, --help            show this help message and exit
  --endpoint {survey,s3,local}
                        Name of the endpoint to use for backup and restore.
                        (default: local)
  --cassandra-version CASSANDRA_VERSION
                        Cassandra version to backup from or restore to.
                        (default: 1.2.0)
  --log-level {FATAL,CRITICAL,ERROR,WARN,INFO,DEBUG}
                        Logging level. (default: INFO)
  --log-file LOG_FILE   Logging file. (default:
                        /var/log/cassback/cassback.log)
...

Help is also available for each command.

$ cassback help backup
usage: cassback backup [-h] [--threads THREADS]
                        [--report-interval-secs REPORT_INTERVAL_SECS]
                        [--recursive]
                        [--exclude-keyspace [EXCLUDE_KEYSPACES [EXCLUDE_KEYSPACES ...]]]
                        [--include-system-keyspace] [--ignore-existing]
                        [--ignore-changes]
                        [--cassandra_data_dir CASSANDRA_DATA_DIR]
                        [--host HOST]

backup SSTables

optional arguments:
  -h, --help            show this help message and exit
  --threads THREADS     Number of writer threads. (default: 4)
  --report-interval-secs REPORT_INTERVAL_SECS
                        Interval to report on the size of the work queue.
                        (default: 5)
  --recursive           Recursively watch the given path(s)s for new SSTables
                        (default: False)
  --exclude-keyspace [EXCLUDE_KEYSPACES [EXCLUDE_KEYSPACES ...]]
                        User keyspaces to exclude from backup. (default: None)
  --include-system-keyspace
                        Include the system keyspace. (default: False)
  --ignore-existing     Don't backup existing files. (default: False)
  --ignore-changes      Don't watch for file changes, exit immediately.
...

Most of the time you will need to specify an endpoint and a command. For example to backup using default settings to a local file.

cassback --endpoint=local --backup-base=/tmp/cassback backup

Or to backup to S3, including the system keyspaces and using a non default Cassandra data directory.

cassback --endpoint s3 --aws-key AWS-KEY --aws-secret AWS-SECRET --bucket-name my-cassandra-backup-bucket backup --include-system --cassandra_data_dir=/mnt/md0/lib/cassandra/data

It's also possible to store command line arguments in a file. For example the call above to backup to S3 can use the s3.conf file

--endpoint=s3
--aws-key=AWS-KEY
--aws-secret=AWS-SECRET
--bucket-name=my-cassandra-backup-bucket

And then be written as

cassback @s3.conf backup --include-system --cassandra_data_dir=/mnt/md0/lib/cassandra/data

Questions, Comments, and Help

Raise issues on the github project or as questions in #cassandra-ops on irc.freenode.net.

cassback's People

Contributors

amorton avatar jeremygrosser avatar mheffner avatar thekad avatar

Watchers

 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.