P
P
pcdesign2021-03-31 09:41:30
linux
pcdesign, 2021-03-31 09:41:30

Is it possible to backup mongodb directly to a remote host?

For example, if you need to backup the database in mysql and upload it to a remote host, there will be such a command

mysqldump <DATABASE_NAME> | gzip -c | ssh [email protected] "cat > /path/to/some-file.sql.gz"


In this case, no files are created on the local machine.
But with mongodump this number doesn't work.
Are there any options?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2021-03-31
@pcdesign

instead of --out, specify --archive, then all collections will be added to one file.
If you do not specify the name of the archive, it will just go to stdout, where you catch it through | ssh
mongodump --archive | gzip -c | ssh [email protected] "cat > /path/to/dump.gz"
ps You can also just connect a remote computer via nfs or sshfs

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question