I have two mysql server both are (MASTER,MASTER). how could we implement clustering in sequelize. if one of sql server has stopped then all request goes to other mysql server without restarting node server.
Asked
Active
Viewed 1,366 times
1 Answers
2
They haven't implemented clustering feature or fallback. I have found a way around for the same.
var Sequelize = require("sequelize");
sequelize.connectionManager.connect = function(){
return new Promise(function(resolve,reject){
// create your connection and return its instance in promise
resolve(connection);
});
}
sequelize.connectionManager.disconnect = function(connection){
// to disconnect the connection
if (!connection._protocol._ended) {
connection.release()
}
return Promise.resolve();
}
I can share code if above code is not enough.

Vikash Sharma
- 204
- 1
- 8
-
3can you please share more details on how this works? – Ali Essam Aug 15 '17 at 11:34