Percona-Lab / mongodb_consistent_backup

A tool for performing consistent backups of MongoDB Clusters or Replica Sets
https://www.percona.com
Apache License 2.0
276 stars 81 forks source link

cannot run backup for single instance of mongodb #240

Closed umsalotagi closed 6 years ago

umsalotagi commented 6 years ago
  1. docker command line in Readme.md should have --net=host so that docker will be able to communicate with localhost mongodb installed on client machine.

  2. I have single instance of mongodb without replication and sharding, when I run this docker command I will get following error :

    [2017-11-09 15:14:35,018] [CRITICAL] [MainProcess] [Main:exception:207] Error setting up mongodb-consistent-backup: Host localhost:27017 is not part of a replset and is
    not a sharding config/mongos server!

How to run backup only for single instance. I am usging default config file provided in this git with only changes are username and password.

Results are on Google compute engine, ubuntu 14

timvaillancourt commented 6 years ago

@umsalotagi can you please provide the output of these shell commands:

  1. db.adminCommand({getCmdLineOpts:1})
  2. rs.conf()
  3. rs.status()
  4. mongodb-consistent-backup --version

Feel free to hide hostnames/IP addresses.

timvaillancourt commented 6 years ago

Hi @umsalotagi,

I just reread your issue description and saw:

I have single instance of mongodb without replication and sharding...

mongodb_consistent_backup relies on the Replication oplog to achieve consistency, thus it will not work on your instance as you do not use replication. I will add to our README.md to make this limitation more clear in the future.

You could successfully use the tool if you enabled replication on the instance and created a 2-node replica set. In the future 1-node replica sets will be supported via a "primary-only" mode.

cukal commented 5 years ago

@timvaillancourt Are 1-node replica sets already supported?

Thanks for a great tool!

timvaillancourt commented 5 years ago

@cukal Currently the tool relies on a secondary member for backups so a single-node replica set is not supported today. There is a feature request to add the ability to backup from Primary, however.