Node red multiple instances

Hi

I have a requirement in which i need to have multiple instances of node red on same machine with different port numbers, different flows. For the same user based on the role defined - flows and palette controls will be displayed. Please clarify

When you start Node-RED you can use the command-line arguments to point at a different settings file and userDirectory for each instance. Each setting file can specify a different port and flow file name.

https://nodered.org/docs/getting-started/running#command-line-usage

Can this be simultaenous, i mean if the user has two roles, he should be able to see the flows associated with both the roles in different url's

A single node-red instance can have multiple users, but they all see the same set of flows - the runtime is not multi-tenant.

Instead of changing settings file, I use the -p command line option to specify the port. I also use nssm on windows for multiple instances. So each service launches for example...

  • node-red -p 1881 -u c:/nr1881
  • node-red -p 1882 -u c:/nr1882
    And so on.

BTW, @knolleary that document you linked to doesn't show the -p option or -t option.

1 Like

Gr8 Steve, could you explain the process of doing this. i would like to do this step by step and try exposing node red in multiple ports(say 4) for my needs.
Thx in advance.

assuming windows (you didnt specify)...

  • Create 4 folders...
    • c:\node-red-1880
    • c:\node-red-1881
    • c:\node-red-1882
    • c:\node-red-1883
  • open 4 cmd windows
    • Start >> Run >> cmd >> {enter}
    • Start >> Run >> cmd >> {enter}
    • Start >> Run >> cmd >> {enter}
    • Start >> Run >> cmd >> {enter}
  • In cmd1...
    • node-red -p 1880 -u c:/node-red-1880
  • In cmd2...
    • node-red -p 1881 -u c:/node-red-1881
  • In cmd3...
    • node-red -p 1882 -u c:/node-red-1882
  • In cmd4...
    • node-red -p 1883 -u c:/node-red-1883

The 4 folders will get populated with your flows & any nodes you add via pallete

:tada:

If you want to make them services - try searching in this forum for a posts mentioning NSSM

Regards.

1 Like

thanks, will NSSM impose security risks ?

In what way?

All it does is wrap a non service application into a service.

If necessary, set the "logon" properties in NSSM to a limited account, then node-red will run under that context.

I see no differences to running from a command line in that regard.

Thanks, will check this out ..