I am not sure if this is a bug or a configuration mistake in my code or mlab issue.
Using heroku with mlab plugin for our app.
We are able to successfully reconnect if instance goes down and comes up.
But when we do a backup deployment from mlab dashboard, mongoose is not able to reconnect with mlab instance after backup is completed. We deploy our app again to successfully connect to server.
During backup 'close and 'disconnect' events are triggered.
Below is my code:
var models = require('../models');
/* To remove the warning coming on server start. */
mongoose.Promise = global.Promise;
reconnectTries: Number.MAX_SAFE_INTEGER ,
I'm not too familiar with mLab and have barely used Heroku, but how is the backup deployment done? Is it just a button you press or do you run a script? If it's a script, could you paste that script here?
@varunjayaraman we kind of press a button, mlab runs scripts that restore the backup data, we follow this.
Hm, it would probably be best to contact mlab about this. Without access to mLab's script, this is pretty difficult to debug, and they might have more information on why you can't reconnect.
Also, if you try connecting with the mongo shell after your backup, does it still fail? If so, it's definitely an mLab issue.
Does the mlab instance go down when you're restoring the backup? For how long?
Tbh I'd just restart the app when you're restoring a backup. It's not something you're going to be doing often I'd hope :)
@vkarpov15 I was looking forward for your reply
yes, the mlab instance does go down. The downtime depends upon the size of back up data, for a few documents it was about 3-5 mins.
certainly in-place restore is something we would use very rarely, so I guess restarting the app it is :)