简体   繁体   English

直接备份mongodb到远程服务器

[英]Backup mongodb directly to remote server

Is there a way to save mongodump archive directly on remote machine (via ssh or rsync) without saving in locally?有没有办法直接在远程机器上保存 mongodump 存档(通过 ssh 或 rsync)而不保存在本地? I see --out option in docs but no suitable examples我在文档中看到 --out 选项,但没有合适的示例

If you do not specify the name of the --archive, it will just go to stdout, where you catch it via |如果您不指定 --archive 的名称,它只会转到标准输出,您可以通过 | 获取它。 ssh. SSH。 This is work for me这对我来说是工作

mongodump --db dbname --gzip  --archive | ssh user@remotehost "cat > /path/to/dump.gz"

Or或者

mongodump --db dbname  --archive | gzip -c | ssh user@remotehost "cat > /path/to/dump.gz"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM