[英]Is there any Mongodb Data backup utility
I am working on mean.JS application, need to provide data backup and restore functionality for user I've come across mongodb-backup but I've issue in using this, backup file is storing in a folder where code is executed ie __dirname
is there any alternative option for storing back-up file in any other location ? 我正在mean.JS应用程序上工作,需要为用户提供数据备份和还原功能,但是我遇到了mongodb-backup的问题,但是在使用此文件时遇到了问题,备份文件存储在执行代码的文件夹中,即
__dirname
是有没有其他选择可以将备份文件存储在其他任何位置?
var backup = require('mongodb-backup');
backup({
uri: 'uri',
root: __dirname,
// write files into this dir
callback: function(err) {
if (err) {
console.error(err);
} else {
console.log('finish');
}
}
});
What happens when you provide "root" as some other directive instead of __dirname ? 当您提供“ root”作为其他指令而不是__dirname时会发生什么?
More than that why you want to back up and restore functionality from node code itself. 除此之外,您还想从节点代码本身备份和还原功能。 There are plenty of tools from mongo to achieve this -
mongo提供了许多工具来实现这一目标-
https://docs.mongodb.com/manual/tutorial/backup-and-restore-tools/ https://docs.mongodb.com/manual/tutorial/backup-and-restore-tools/
cloud based - https://docs.mongodb.com/v3.2/core/backups/ 基于云-https: //docs.mongodb.com/v3.2/core/backups/
If you want periodic backups and restore then you can create crons and scripts to achieve that. 如果要定期备份和还原,则可以创建克隆和脚本来实现。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.