Open 7HUND3RX opened 3 years ago
I have the same issue.
I am experiencing this issue as well. Seems to be related to when instances number is specified in the ecosystem file (or probably the cli).
@7HUND3RX If you change your exec_mode to fork, does that fix your problem?
@siftd106 Yes, it works well in the fork mode
in cluster mode, I have the same ploblem.
I have the same issue in cluster mode. Did anyone manage to fix that?
I have the same issue in cluster mode. Did anyone manage to fix that?
I've fixed it by moving pm2 configs into pm2.config.json
like so:
{
"apps": [
{
"name": "project-name",
"script": "./index.ts",
"instances": "2",
"exec_mode": "cluster",
"interpreter": "node",
"interpreter_args": "-r ts-node/register/transpile-only -r tsconfig-paths/register"
}
]
}
What I did is copy-pasted working example from pm2 repo https://github.com/Unitech/pm2/blob/master/examples/cluster-http/ecosystem.config.js and adjusted the config to my project.
As far as I remember - the crusial part was to specify "exec_mode": "cluster"
param in this config.
Dunno why, but it didn't work with console command param in my case (pm2 start app.js -i max
).
Same issue is happening to me in cluster
mode.
What's going wrong?
Anything my node js app logs goes straight to the daemon log (pm2.log) instead of going to the process's log file. For multiple processes, all of them go to pm2.log
How could we reproduce this issue?
Supporting information