# Multiple node red instances

**URL:** <https://discourse.nodered.org/t/multiple-node-red-instances/18002>\
**Category:** General\
**Created:** [15 November 2019 13:50 UTC](https://discourse.nodered.org/t/multiple-node-red-instances/18002 "2019-11-15T13:50:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Meng](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@Meng](https://discourse.nodered.org/u/Meng)\
**Post date:** [15 November 2019 13:50 UTC](https://discourse.nodered.org/t/multiple-node-red-instances/18002/1 "2019-11-15T13:50:36Z")

</div>

What is the best way to run multiple node-red instances? As far as i can find a different port is needed for every instance. Is sharing the setting.js file and or node\_modules a good option? Or is it advised to make multiple folders?

For now i am using: node-red -p 1881 -u C:\Users\xx.node-red test.json and node-red -p 1881 -u C:\Users\xxx\Test2

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [15 November 2019 14:45 UTC](https://discourse.nodered.org/t/multiple-node-red-instances/18002/2 "2019-11-15T14:45:18Z")

</div>

It depends on your use case.

In my setups I am using one Node-RED installation and launch different workspaces with `-u`, each with their own dependencies, settings.js, flows.json and so on.

Structured like this:

```auto
.
├── apps
│ ├── node-red -> node-red_1.0
│ ├── node-red_0.19
│ ├── node-red_0.20
│ └── node-red_1.0
└── workspaces
    ├── node-red-controller
    │ ├── flows_cred.json
    │ ├── flows.json
    │ ├── lib
    │ ├── node_modules
    │ ├── package.json
    │ ├── package-lock.json
    │ └── settings.js
    ├── node-red-dashboard
    │ ├── flows_cred.json
    │ ├── flows.json
    │ ├── lib
    │ ├── node_modules
    │ ├── package.json
    │ ├── package-lock.json
    │ ├── settings.js
    │ └── static
    ├── node-red-telegram
    │ ├── flows_cred.json
    │ ├── flows.json
    │ ├── lib
    │ ├── node_modules
    │ ├── package.json
    │ ├── package-lock.json
    │ └── settings.js
    └── node-red-test
        ├── flows_cred.json
        ├── flows.json
        ├── lib
        ├── package.json
        └── settings.js

```

Everything is managed with a PM2 ecosystem file.

After all it's not very different from your approach.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [15 November 2019 17:14 UTC](https://discourse.nodered.org/t/multiple-node-red-instances/18002/3 "2019-11-15T17:14:00Z")

</div>

In my own case, I use my alternate installer so that each instance is self-contained & I don't have to mess with the package.json because it contains the startup scripts (`npm start`), the script doesn't need to change because the userDir for each instance is in the `data` subfolder.

As with Matthias's example, the advantage is that you can run each instance with a different version of Node-RED if you like. You could also adapt the start script to run a custom version of node.js if you needed to.

By the way @kuema, are you trying to copy my picture?! I've only just noticed that you also have an archery image but facing in the other direction 😃

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [15 November 2019 17:15 UTC](https://discourse.nodered.org/t/multiple-node-red-instances/18002/4 "2019-11-15T17:15:23Z")

</div>

Looks like a standoff when you two guys get chatting...  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/7/78add04087a2293fd115a71d965f1971b5513e5c.jpeg)

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [16 November 2019 15:35 UTC](https://discourse.nodered.org/t/multiple-node-red-instances/18002/5 "2019-11-16T15:35:38Z")

</div>

> [@TotallyInformation](#):
>
> By the way @kuema, are you trying to copy my picture?! I've only just noticed that you also have an archery image but facing in the other direction

Julian (@TotallyInformation), I have been using that picture for a while now, and you have noticed just now? 😁 But in fact, that was not intentional. I used it as my Github avatar, so it got moved over here when I signed up at the forum. The difference is, I'm a lefty. 🤓

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [16 November 2019 15:45 UTC](https://discourse.nodered.org/t/multiple-node-red-instances/18002/6 "2019-11-16T15:45:21Z")

</div>

There have been even funnier constellations... so try not to get in between 🙈😂

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/6/6c888057b6a923db30e74d87dffdb4c99adc8e77.png)

---

<div class="post-metadata">

**Author:** ![hominidae](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hominidae/32/4174_2.png) [@hominidae](https://discourse.nodered.org/u/hominidae)\
**Post date:** [16 November 2019 17:08 UTC](https://discourse.nodered.org/t/multiple-node-red-instances/18002/7 "2019-11-16T17:08:57Z")

</div>

...FWIW, I am using node-red in a docker install.  
This way I can have as many instances as i want/need, each looking like a separate host install, including individual IPs .. no need for mapping ports and everything
