Search code examples
node.jsexpresspm2

PM2 not making clusters


I just installed pm2, I already has done clustering in my app.js using node cluster module.

When I use pm2 start app.js -i 4 to start my app.js it only show me one online instance. It should show me 4 instance Please tell me what is the problem

Screenshot attached


Solution

  • Run this command...

    it should work.

    pm2 stop all

    pm2 delete all

    pm2 start app.js -i 2

    where i is the number of instance you want to start.

    Always use pm2 delete all to unregister the CPU, since if you stop it, it still reserve the CPU