Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mongodump without mongodb

Tags:

mongodb

Since it is possible to mongodump/mongorestore remotely, it makes sense to have them installed in a machine that is not the DB itself, right?

Is there a way to install a standalone mongodump executable?

Eg. in order to dockerize my DB backup tool

like image 793
Augustin Riedinger Avatar asked Mar 13 '17 14:03

Augustin Riedinger


People also ask

Should I use Mongodump or Mongoexport?

Mongodump is preferable ,if whole database or collection needs to be backedup. use Mongorestore to restore the backed up data, its very fast , stores in Bson mongoexport is preferable for backing up the subset of the documents in a collection Slow compared to mongodump .

Where is Mongodump used?

It is recommended to use the corresponding versions of mongodump and mongorestore in backup and restore operations. The mongodump command will overwrite the existing files within the given backup folder. The default location for backups is the dump/ folder.

Does Mongodump lock the database?

Mongdump does not lock the db. It means other read and write operations will continue normally. Actually, both mongodump and mongorestore are non-blocking. So if you want to mongodump mongorestore a db then its your responsibility to make sure that it is really a desired snapshot backup/restore.


2 Answers

Ubuntu has the tools separate: mongodb-org-tools
Alpine also has an edge/community package: mongodb-tools

I am using the node:alpine Docker to run mongodump/restore and upload to S3, it works well.

You could also try installing and then copying the binaries, but I imagine they have a lot of dependencies so you might as well find a way to use the tools package, or you'll be creating your own.

like image 151
Nick Avatar answered Nov 01 '22 00:11

Nick


mongo-tools since Ubuntu 18.04: https://launchpad.net/ubuntu/bionic/+package/mongo-tools

sudo apt install mongo-tools
like image 30
Buzzeins Avatar answered Nov 01 '22 02:11

Buzzeins