Created
February 1, 2018 13:16
-
-
Save devarajchidambaram/5a196ccda2634f872697f0e3a6b1d597 to your computer and use it in GitHub Desktop.
To gently reload the config in nodejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://www.npmjs.com/package/recluster | |
var recluster = require('recluster'), | |
path = require('path'); | |
var cluster = recluster(path.join(__dirname, 'server.js'),{workers : 2}); | |
cluster.run(); | |
process.on('SIGUSR2', function() { | |
console.log('Got SIGUSR2, reloading cluster...'); | |
cluster.reload(); | |
}); | |
console.log("spawned cluster, kill -s SIGUSR2", process.pid, "to reload"); | |
//Use this command to kill and reload the nodejs cluster | |
//[root@linux90 ~]# kill -s SIGUSR2 2091 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment