Multiple instances of node-red using PM2?

#1

Greetings,

I run node-red with pm2 using :-

pm2 start node-red

which works fine.

I can manually start a second instance with its own settings file from the command line :-

node-red -s node-red2/settings.js -u node-red2 &

and this works fine . . .

Any ideas how I can manage the second instance through pm2 aswell, so it autostarts etc. ?

I've tried

pm2 start node-red --name "node-red2" --node-args="-s node-red2/settings.js -u node-red2"

which errored trying to start node-red2 and also had the interesting side effect of killing the initial node-red instance :wink:

any ideas appreciated,
thx,
Gav

#2

Hi Gav,

The first thing I would try is setting the port number on the pm2 call ... i.e. -p. If the two instances of node-red are fighting for the same port that might be the problem.

#3

You will need to create a process file with your 2 instances, see http://pm2.keymetrics.io/docs/usage/application-declaration/