Skip to main content

Python CLI for cassandra snapshots. CLI allows to store and restore snapshot and uses AWS S3 bucket as storage.

Project description

Python Cassandra CLI tool

Release Notes

1.1.1

Clean up code

1.1.0

  1. Added --ssl flag for cqlsh command if connection supports only SSL connection; --ssl-cqlsh option
  2. Logic -p flag for sstableloader not mandatory for SSL connection type
  3. Overriding folder main folder name; --snapshot-folder-override option

1.0.3

Fix option description: create-keyspace-schema

1.0.2

Updated Authentication logic

1.0.1

Added boto3 libs in requirements

1.0.0

Initial release

Descirptoin

CLI has 5 main commands:

  1. copy-snapshot-folder Copy folder with snapshots from s3 bucket
  2. restore-snapshot-keyspace Restore Keyspace snapshot from s3 bucket
  3. restore-snapshot-table Restore Table snapshot from s3 bucket
  4. store-snapshot-keyspace Take and store Keyspace snapshot to s3 bucket
  5. store-snapshot-table Take and store Table snapshot to s3 bucket

AWS resources access

AWS S3 bucket

  1. You need to set -s3(--s3-bucket), -id(--aws-access-key-id) and -key(--aws-secret-access-key) options for the connection to AWS S3 bucket via access key.
  2. If your host has AWS profile setup in .aws/credentials and/or IAM role with s3 bucket permissons then CLI needs only -s3(--s3-bucket) option.

AWS Systems Manager

  1. You need to set -sn(--secret-name), -id(--aws-access-key-id) and -key(--aws-secret-access-key) for getting secrest from Paramenter Store.
  2. If your host has AWS profile setup in .aws/credentials and/or IAM role with SSM permissons then CLI needs only -sn(--secret-name) option.
  3. Optionally you can change -r(--aws-region) for SSM. Default value is 'us-east-1'

Commands examples:

Store keyspace snapshot on s3

python-cassandra-cli store-snapshot-keyspace  
  -k my_keyspace 
  -t tag-01-keyspace
  -e dev 
  -s3 my.s3.bucket 
  -h "10.99.3.55"   
  --ssm-secret -sn /cassandra/dev 

Store keyspace snapshot on s3 with keyspace schema

python-cassandra-cli store-snapshot-keyspace  
  -k my_keyspace 
  -t tag-01-keyspace
  -e dev -s3 my.s3.bucket -h "10.99.3.55"  
  --ssm-secret -sn /cassandra/dev 
  --create-keyspace-schema

Store table snapshot on s3 with keyspace schema

python-cassandra-cli store-snapshot-table 
  -k my_keyspace 
  -tn my_table
  -t tag-01-table 
  -e dev 
  -s3 my.s3.bucket 
  -h "10.99.3.55"  
  --ssm-secret
  -sn /cassandra/dev 
  --create-keyspace-schema

Resotore table

python-cassandra-cli restore-snapshot-table 
  -sf 1608700346_snapshots_tag-01-keyspace_my_keyspace_develop 
  -t tag-01-table 
  -k my_keyspace 
  -tn my_table -h "10.99.3.55" 
  --ssm-secret 
  -sn /cassandra/dev 
  -s3 my.s3.bucket

Restore table ssl

python-cassandra-cli restore-snapshot-table  
  -sf 1608700346_snapshots_tag-01-table_my_table_develop 
  -t tag-01-table 
  -k my_keyspace 
  -tn my_table 
  -h "10.99.3.55" 
  --ssm-secret 
  -s3 my.s3.bucket 
  -sn /cassandra/dev 
  -cf /etc/cassandra/conf/cassandra.yaml  
  -ks /etc/cassandra/conf/keystore.node0 
  -ts /etc/cassandra/conf/truststore.node0 
  -ssl 
  -pt 9142 

Restore keyspace ssl with keyspace creation

python-cassandra-cli restore-snapshot-keyspace  
  -sf 608700346_snapshots_tag-01-keyspace_my_keyspace_develop 
  -t tag-01-keyspace 
  -k my_keyspace  
  -h "10.99.3.55" 
  --ssm-secret 
  -s3 my.s3.bucket 
  -sn /cassandra/dev 
  --create-keyspace-schema 
  -e develop 
  -cf /etc/cassandra/conf/cassandra.yaml  
  -ks /etc/cassandra/conf/keystore.node0 
  -ts /etc/cassandra/conf/truststore.node0 
  -ssl 
  -pt 9142 

Copy folder with sanpshot on local

python-cassandra-cli copy-snapshot-folder 
  -s3 my.s3.bucket 
  -sf 1608700346_snapshots_tag-01-keyspace_my_keyspace_develop

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-cassandra-cli-1.1.1.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_cassandra_cli-1.1.1-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file python-cassandra-cli-1.1.1.tar.gz.

File metadata

  • Download URL: python-cassandra-cli-1.1.1.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5

File hashes

Hashes for python-cassandra-cli-1.1.1.tar.gz
Algorithm Hash digest
SHA256 7c4c5a0b12ac9eb97335bafa74afefe6fb7ee6e0240ef9107366c5070dc3c0ab
MD5 158e86d9b9fa91329e2c6e4164f0ae3e
BLAKE2b-256 0a9776ee01cc828c29fe66c45c6fd6cd9b4ddac4496ac286f8575a85d0e9e49e

See more details on using hashes here.

File details

Details for the file python_cassandra_cli-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: python_cassandra_cli-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5

File hashes

Hashes for python_cassandra_cli-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4157f8d72a9066a19aa21967a701eed4cfe3ab6dd105979ed683992785a054d1
MD5 034a903a20d8aac1be50f84f23906e26
BLAKE2b-256 e12ae390af9aec0338e208f430b0f15b8d0127513fe98bde19375356fb5b4e97

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page