# Running Multiple Instances of Node-red using NSSM

**URL:** https://discourse.nodered.org/t/running-multiple-instances-of-node-red-using-nssm/57127
**Category:** General
**Created:** [24 January 2022 08:39 UTC](https://discourse.nodered.org/t/running-multiple-instances-of-node-red-using-nssm/57127 "2022-01-24T08:39:49Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)
#### Post date: [24 January 2022 08:39 UTC](https://discourse.nodered.org/t/running-multiple-instances-of-node-red-using-nssm/57127/1 "2022-01-24T08:39:49Z")

</div>

Continuing the discussion from [Node red multiple instances](https://discourse.nodered.org/t/node-red-multiple-instances/9787/11):

I ran through this entire thread, but unable to start second service for Node-Red  
One is running successfully, other doesn't start.

the message says ' the service did not return an error' could be internal or windows error .

what arguments should i pass in the NSSM ?

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [24 January 2022 08:46 UTC](https://discourse.nodered.org/t/running-multiple-instances-of-node-red-using-nssm/57127/2 "2022-01-24T08:46:07Z")

</div>

Assuming you setup your folders like described in that thread (a few posts above the one you linked to) ([this post](https://discourse.nodered.org/t/node-red-multiple-instances/9787/7)) then you would set your NSSM commands to run each instance in the same way as if you were running it from a cmd window

example...

NSSM1: `node-red -p 1880 -u c:/node-red-1880`  
NSSM2: `node-red -p 1881 -u c:/node-red-1881`  
NSSM3: `node-red -p 1882 -u c:/node-red-1882`

etc etc

Just be sure that the account that runs the NSSM service has read/write access to these folders.

---

<div class="post-metadata">

### Author: ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)
#### Post date: [24 January 2022 09:49 UTC](https://discourse.nodered.org/t/running-multiple-instances-of-node-red-using-nssm/57127/3 "2022-01-24T09:49:20Z")

</div>

I am sorry, my first service which is successfully running, is not in this format,  
this is what i have in first service

```auto
Path: c:\Users\oee\AppData\Roaming\npm\node-red.cmd
Startup directory : c:\users\oee\.node-red
Arguments : -u c:\users\oee\.node-red > c:\temp\node-red.log

```

so i don't know where to put the second service

i am running second instance successfully from command window by using this command

```auto
node-red -userDir c:\Users\oee2\.node-red2 second.json

```

in second settings file, i have put 1881 as the port address

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [24 January 2022 09:56 UTC](https://discourse.nodered.org/t/running-multiple-instances-of-node-red-using-nssm/57127/4 "2022-01-24T09:56:43Z")

</div>

> [@smanjunath211](#):
>
> i am running second instance successfully from command window by using this command
> 
> ```auto
> node-red -userDir c:\Users\oee2\.node-red2 second.json
> 
> ```

So use that command in your second NSSM service.

Note. I don't recommend this setup. If user oee2 is removed or locked out you can lose work.

The folder format & commands I linked 2 is far more obvious, user friendly and safe.

It is of course up to you how you arrange things.

---

<div class="post-metadata">

### Author: ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)
#### Post date: [24 January 2022 10:02 UTC](https://discourse.nodered.org/t/running-multiple-instances-of-node-red-using-nssm/57127/5 "2022-01-24T10:02:41Z")

</div>

sorry for being a noob.

should i put this command in **Path** or **Arguments** in edit nssm window ?

`node-red -userDir c:\Users\oee2\.node-red2 second.json`

i tried in both, but not working.

however, there is no error. just that i cant access the 1881 port from browser, says Lost connection

EDIT : It started working, the setting was fine, just there was a huge delay in actual starting the service.

---

<div class="post-metadata">

### Author: ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)
#### Post date: [24 January 2022 10:19 UTC](https://discourse.nodered.org/t/running-multiple-instances-of-node-red-using-nssm/57127/6 "2022-01-24T10:19:46Z")

</div>

```auto
Path : <same as service 1>
Startup Directory : Second Folder (Same User)
Arguments : -userDir c:\users\<same user as service1>\<second folder> second.json > c:\temp\node-red2.log

```

I dont know but it is having a huge delay. (3 minutes)  
attaching log below may be you can help me understand if there is any issue.  
taking 3 minutes to load pallet nodes (or start loading?)

there is a delay in my first service also, but that was a bigger flow file, so i had assumed the delay is natural. but this second flow is very small

```auto
24 Jan 15:40:59 - [info] Windows_NT 10.0.19042 x64 LE
24 Jan 15:44:09 - [info] Loading palette nodes

```

* * *

```auto
24 Jan 15:40:59 - [info] 

Welcome to Node-RED
===================

24 Jan 15:40:59 - [info] Node-RED version: v2.1.4
24 Jan 15:40:59 - [info] Node.js version: v14.17.3
24 Jan 15:40:59 - [info] Windows_NT 10.0.19042 x64 LE
24 Jan 15:44:09 - [info] Loading palette nodes
24 Jan 15:44:11 - [info] Settings file : c:\users\oee.Hosur\.node-red2\settings.js
24 Jan 15:44:11 - [info] Context store : 'default' [module=memory]
24 Jan 15:44:11 - [info] User directory : c:\users\oee.Hosur\.node-red2
24 Jan 15:44:11 - [warn] Projects disabled : editorTheme.projects.enabled=false
24 Jan 15:44:11 - [info] Flows file : C:\Users\OEE.Hosur\.node-red2\db.json
24 Jan 15:44:11 - [warn] 

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

24 Jan 15:44:11 - [info] Server now running at http://127.0.0.1:1881/
24 Jan 15:44:11 - [info] Starting flows

```

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [24 January 2022 10:47 UTC](https://discourse.nodered.org/t/running-multiple-instances-of-node-red-using-nssm/57127/7 "2022-01-24T10:47:18Z")

</div>

If you set the log level to trace in settings.js then it will show more information when loading the nodes. Probably something is holding up the initialisation of one of the nodes. Possibly a network timeout or something.

---

<div class="post-metadata">

### Author: ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)
#### Post date: [24 January 2022 11:07 UTC](https://discourse.nodered.org/t/running-multiple-instances-of-node-red-using-nssm/57127/8 "2022-01-24T11:07:52Z")

</div>

Thanks,

Funny that i changed the "info" to "trace" in log settings and now it is loading instantly !  
**within 20 seconds** from earlier 3 minutes

so if it is an external factor, it may repeat again, but i can live with that..

Thanks for the Help.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [24 January 2022 13:46 UTC](https://discourse.nodered.org/t/running-multiple-instances-of-node-red-using-nssm/57127/9 "2022-01-24T13:46:15Z")

</div>

The 3 minute delay can be caused by a known issue if your node-red instance does not have an internet connection or is behind a proxy...

> [@Node-RED v0.19.4 3 minute delay during startup on windows](https://discourse.nodered.org/t/node-red-v0-19-4-3-minute-delay-during-startup-on-windows/3798/15):
>
> Finally - node-red startup 3 minutes faster! For anyone behind a proxy having a 3 minute delay starting node-red... Using notepad/text editor, open node-red.cmd (look in you NPM Global folder) Add the following line to the top of the file (before any other command) SET NO\_UPDATE\_NOTIFIER=1 Start node-red using the cmd file node-red.cmd Enjoy the extra 3 mins slight_smileThanks to @hotNipi, @KarnanKurup for pointing me in the right direction .

---

<div class="post-metadata">

### Author: ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)
#### Post date: [24 January 2022 15:04 UTC](https://discourse.nodered.org/t/running-multiple-instances-of-node-red-using-nssm/57127/10 "2022-01-24T15:04:29Z")

</div>

Wow, really. Indeed the PC which runs my node red flows does not have continuous internet, it is connected to the modbus TCP server through LAN where it collects sensor data (with no internet). I was connecting it as and when required to download some nodes or copying the outputs to post in this forum.

Thanks

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [7 February 2022 15:04 UTC](https://discourse.nodered.org/t/running-multiple-instances-of-node-red-using-nssm/57127/11 "2022-02-07T15:04:53Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
