简体   繁体   中英

Mongodb Backup over nodeJS

I have a mongoDB instance and using via my NodeJs/Express App. I have hosted it on Openshift. I am not able to figure out how to run a cron to backup the db.

I dont want to backup to s3.

尝试将包节点计划用于cron之类的过程。

Use node-schedule package to run your cron.

var schedule = require('node-schedule');

// Runs at 12am daily
schedule.scheduleJob('0 0 12 * *', function(){
    // Perform your database query to update your backup
});

OR Create a new DB (let's call it backup) and each time you update your actual DB, also insert into the backup DB.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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