Skip to main content

A tool to backup mongodb

Project description

Backup mongodb data by copy dbpath

Downloads

Install

$ pip install mongodb-backup

Usage

$ mongodbbackup --help

Make sure which mongod instance you want to backup, and run mongodbbackup on that server.

Example

  • Backup a standalone mongod instance.

    $ mongodbbackup -p <port> --primary-ok <backup_dir>

    Caution: it will block all writes.

  • Backup a replication, run the follow command on a secondary server.

    $ mongodbbackup -p <secondary_port> <backup_dir>
  • Backup a cluster, backup a config server and each shard. If you have two shards, you need to run the follow command three times.

    $ mongodbbackup --ms-url <mongos_url> -p <port> <backup_dir>

Under The Hood

This tool backup mongodb by copying dbpath, so it must run on the same machine with the mongod instance.

  1. Fsync the mongod instance to block all writes.

  2. Copy the dbpath.

  3. Unlock the mongod instance to accept writes.

If you want to backup a mongodb cluster, you should specify --ms-url option. It will stop balancer before backup, and restart balancer after backup.

Caution: This tool doesn’t make a point-in-time backup, it just copy the data directory, you can copy back the data to restore if any disaster happens.

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

mongodb-backup-0.1.5.tar.gz (3.7 kB view details)

Uploaded Source

File details

Details for the file mongodb-backup-0.1.5.tar.gz.

File metadata

File hashes

Hashes for mongodb-backup-0.1.5.tar.gz
Algorithm Hash digest
SHA256 25b20a64de2007938ee7642052293a1e7a45a98c362609181a708a89e13e3896
MD5 fa7387586e50a96b1b883fdc92ebb046
BLAKE2b-256 db55472e8488863fdc054d7a6b50e253f709ae3648124eb7e06a53357f59bfda

See more details on using hashes here.

Provenance

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