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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file mongodump-s3-1.1.2.tar.gz.

File metadata

  • Download URL: mongodump-s3-1.1.2.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.3

File hashes

Hashes for mongodump-s3-1.1.2.tar.gz
Algorithm Hash digest
SHA256 84b13a93547343738a75349aa2d264e379bbbd46c1c666968b9fedb92145c56f
MD5 636f46dd907e96cd689611fe58a99880
BLAKE2b-256 1649a7e4c10e045855045c2b459f3775418a27f9e3b020c3f128ceea7ffcce9d

See more details on using hashes here.

File details

Details for the file mongodump_s3-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: mongodump_s3-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.3

File hashes

Hashes for mongodump_s3-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f5cd7d8f63d074a375082f1dd25117a63fc9011db322b38cb9c6d03255dcfb73
MD5 1b0223e49159ee221794bdf0ff2ac76c
BLAKE2b-256 cc68193426aa673a4c0a035f641e597ac77ca9ab88d50a5293fb00b32fffe6b8

See more details on using hashes here.

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