Next.js Discord

Discord Forum

How to use cluster mode in pm2

Unanswered
Chinese perch posted this in #help-forum
Open in Discord
Chinese perchOP
[ Nextjs pm2 config file ]

module.exports = {
apps: [
{
name: 'test',
script: 'npm',
args: 'start',

instances: 0,
exec_mode: 'cluster',
listen_timeout: 50000,
kill_timeout: 5000,

time: true,
merge_logs: true,
log_file: 'logs/pm2/log.log',
out_file: 'logs/pm2/out.log',
error_file: 'logs/pm2/error.log',
},
],
};

This is my current config file.
The problem is that all but one instance are infinitely restarted, and then error handling occurs and it does not work. What I don't understand is that there is no log left. Any idea why?

0 Replies