Skip to main content

A python command line tool that simplify MongoDB backup (mongodump/mongorestore) to Amazon S3.

Stdout/stderr is displayed for each command so if something goes wrong, you can see it immediately.

You can download and restore generated backups yourself without mo2s3 (just download, untar and mongorestore).

Requirements

It makes use of argparse for parsing arguments, mongodump/mongorestore/tar with envoy and boto to upload/download to S3.

  • Envoy python subprocesses for humans

  • Boto to interact with AWS S3

  • Argparse for parsing command line arguments

Installation

$ pip install mo2s3

You can configure your AWS/MongoDB credentials with mo2s3:

$ mo2s3 configure

And you can also edit ~/.mo2s3.cfg.

Usage

Basic usage, mo2s3 -h to show the help.

List bucket files

$ mo2s3 list

Perform Backup

$ mo2s3 backup

$ mo2s3 backup –db mydb

Restore

$ mo2s3 restore –filename mongodump_20120610235933.tgz

$ mo2s3 restore –host anotherhost.com:27017 –db mydb –filename mongodump_mydb_20120611150815.tgz

Delete backup

$ mo2s3 delete –filename mongodump_20120610235933.tgz

Delete all backups

$ mo2s3 drop

How It Works

Here is how a backup is performed:

  1. Run mongodump on the current directory

  2. Create tgz of the dump with tar

  3. Upload to S3 with boto

  4. Delete every generated file

And to restore:

  1. Download archive from S3

  2. Untar to current directory

  3. Mongorestore the dump

  4. Delete every downloaded file

License (MIT)

Copyright (c) 2012 Thomas Sileo

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Metadata

Release files for mo2s3 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mo2s3 0.0.1
File Size Uploaded
mo2s3-0.0.1.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mo2s3 0.0.1
File Interpreter ABI Platform
mo2s3-0.0.1-py2.7.egg Legacy Egg format - - Details

Total release size: 12.1 kB

Release files / mo2s3-0.0.1.tar.gz

Download URL mo2s3-0.0.1.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1beace96f31f3eb8cd751616aaba0ecd42efd66453bb8f1052882467a9d8eeca
BLAKE2b-256 checksum
How to use checksums
47f5a96a01812d55204b9f3b8c6e2c4f837a1e76fa142a41abc82c02be6c9b7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / mo2s3-0.0.1-py2.7.egg

Download URL mo2s3-0.0.1-py2.7.egg
Size 7.6 kB
Tags Egg
SHA-256 checksum
How to use checksums
423be61612f3559aa236efd2c31145a5b9966910deebb5884c958465cf9f0e38
BLAKE2b-256 checksum
How to use checksums
bc9abdb401e0084167fdebf6b6db5afb96aed680733b1ed6da695f3b882ccc2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page