Skip to main content

Backup utility for MongoDB. Compatible with Azure, Amazon Web Services and Google Cloud Platform.

Project description

mongo-dump

Codacy Badge DeepSource release Actions Status build Actions Status PyPI Version Docker Image Size

Backup utility for MongoDB. Compatible with Azure, Amazon Web Services and Google Cloud Platform.

Installation

Make sure that original MongoDB Database Tools are installed. Please follow instruction on the official page for platform specific installation. Also make sure that mongodump command is in your PATH.

pip install mongodump-s3

Usage

mongodump-s3 could be used as command line tool or as Docker service. There are also three possible ways to pass parameters to the utility:

  • Through setting environment variables
  • By passing env file to the tool
  • Or by passing individual flags

Please refer to sample.env example for all possible env options.

Command line

$ mongodump-s3 --help
usage: mongodump-s3 <options>

Export the content of a running server into .bson files and uploads to provided S3 compatible storage. By default loads required settings from environment variables.

general options:
  -h, --help            print usage
  -v, --version         print the tool version and exit

output options:
  -b <S3 Bucket>, --bucket <S3 Bucket>
                        S3 bucket name for upload, defaults to 'mongodump'
  -o <folder>, --out <folder>
                        output directory, defaults to 'dump'

uri options:
  -u <uri>, --uri <uri>
                        mongodb uri connection string. See official description here https://docs.mongodb.com/manual/reference/connection-string

environmental options:
  -e <env-file>, --env <env-file>
                        path to file containing environmental variables

cloud storage options:
  --azure "<azure_storage_connection_string>"
                        connection string for storage account provided by Azure
  --aws "<aws_access_key_id=value> <aws_secret_access_key=value> <aws_region=value>"
                        AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION properties provided by Amazon Web Services IAM. AWS_REGION defaults to 'us-west-2' if not specified
  --gcp "<google_application_credentials=value> <google_region=value>"
                        path to service account file and optional Google Cloud Region. GOOGLE_REGION defaults to 'us-multiregion' if not specified

notification options:
  --email <user@example.com>
                        email address which to notify upon the result
  --smtp <mail-server.example.com>
                        SMTP relay server to use, defaults to 'localhost'
  --telegram "<telegram_token=value> <telegram_chat_id=value>"
                        Telegram API token and chat id to be used for notification. See more: https://core.telegram.org/bots/api

Docker

sudo docker run --name mongo-dump [Optional: --env-file sample.env] exesse/mongodump-s3:latest [Optional: startup flags]

In case you need to pass GCP service account key please mount the key inside container and simply specify GOOGLE_APPLICATION_CREDENTIALS=/mongo-dump/key.json.

sudo docker run --name mongodump-gcp \
    --env-file sample.env \
    -v ~/dev.json:/mongodump/key.json:ro \
    exesse/mongodump-s3:latest 

Feedback

Email bug reports, questions, discussions to hi@exesse.org.

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

mongodump-s3-1.1.2.tar.gz (12.9 kB view hashes)

Uploaded Source

Built Distribution

mongodump_s3-1.1.2-py3-none-any.whl (14.3 kB view hashes)

Uploaded Python 3

Supported by

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