# Node-red multiple instances

**URL:** <https://discourse.nodered.org/t/node-red-multiple-instances/73774>\
**Category:** General\
**Created:** [16 January 2023 18:34 UTC](https://discourse.nodered.org/t/node-red-multiple-instances/73774 "2023-01-16T18:34:38Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![interscope101](https://avatars.discourse-cdn.com/v4/letter/i/a88e4f/32.png) [@interscope101](https://discourse.nodered.org/u/interscope101)\
**Post date:** [16 January 2023 18:34 UTC](https://discourse.nodered.org/t/node-red-multiple-instances/73774/1 "2023-01-16T18:34:38Z")

</div>

Hi! I followed this guide to get another instance running: duplicate settings file, different port, mapped to different subdomain (nginx). How should I have this start automatically like my primary instance (which was was installed via the pi script, running as a service). Thanks!

> **[Installing and Starting Node-Red - Steves Node-Red Guide](http://stevesnoderedguide.com/installing-node-red)**
>
> A quick guide on how to install node-red on Linux and windows as well as starting options.Includes video

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [16 January 2023 19:21 UTC](https://discourse.nodered.org/t/node-red-multiple-instances/73774/2 "2023-01-16T19:21:55Z")

</div>

Have you thought about asking 'Steve', the author of that website? Looks like he is very active and commented on a question just a few days ago.

---

<div class="post-metadata">

**Author:** ![interscope101](https://avatars.discourse-cdn.com/v4/letter/i/a88e4f/32.png) [@interscope101](https://discourse.nodered.org/u/interscope101)\
**Post date:** [16 January 2023 20:14 UTC](https://discourse.nodered.org/t/node-red-multiple-instances/73774/3 "2023-01-16T20:14:00Z")

</div>

Good idea - thanks!

---

<div class="post-metadata">

**Author:** ![interscope101](https://avatars.discourse-cdn.com/v4/letter/i/a88e4f/32.png) [@interscope101](https://discourse.nodered.org/u/interscope101)\
**Post date:** [16 January 2023 23:23 UTC](https://discourse.nodered.org/t/node-red-multiple-instances/73774/4 "2023-01-16T23:23:35Z")

</div>

The tutorial references where the node red service start is specified. I am wondering if I can simply duplicate the statement to start the two instances.

```auto
If you want to load node-red on startup with a different settings file than the settings.js you will need to edit the file /lib/systemd/system/nodered.service.

un-comment the line ExecStart if not already done and the Environment=”NODE_RED_OTPIONS=-v” line to something like:

Environment="NODE_RED_OPTIONS=-s /home/pi/.node-red/mysettings.js"

```

```auto
# systemd service file to start Node-RED

[Unit]
Description=Node-RED graphical event wiring tool
Wants=network.target
Documentation=http://nodered.org/docs/hardware/raspberrypi.html

[Service]
Type=simple
# Run as normal pi user - change to the user name you wish to run Node-RED as
User=ubuntu
Group=ubuntu
WorkingDirectory=/home/ubuntu

Environment="NODE_OPTIONS=--max_old_space_size=512"
# define an optional environment file in Node-RED's user directory to set custom variables externally
EnvironmentFile=-/home/ubuntu/.node-red/EnvironmentFile
# uncomment and edit next line if you need an http proxy
#Environment="HTTP_PROXY=my.httpproxy.server.address"
# uncomment the next line for a more verbose log output
#Environment="NODE_RED_OPTIONS=-v"
# uncomment next line if you need to wait for time sync before starting
#ExecStartPre=/bin/bash -c '/bin/journalctl -b -u systemd-timesyncd | /bin/grep -q "systemd-timesyncd.* Synchronized to time server"'

ExecStart=/usr/bin/env node-red-pi $NODE_OPTIONS $NODE_RED_OPTIONS
#ExecStart=/usr/bin/env node $NODE_OPTIONS red.js $NODE_RED_OPTIONS
# Use SIGINT to stop
KillSignal=SIGINT
# Auto restart on crash
Restart=on-failure
RestartSec=20
# Tag things in the log
SyslogIdentifier=Node-RED
#StandardOutput=syslog

[Install]
WantedBy=multi-user.target

```

---

<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:** [17 January 2023 07:27 UTC](https://discourse.nodered.org/t/node-red-multiple-instances/73774/5 "2023-01-17T07:27:35Z")

</div>

You need a service file for each instance. Then you can individually control them, and they will individually restart in the case of crashes.

---

<div class="post-metadata">

**Author:** ![interscope101](https://avatars.discourse-cdn.com/v4/letter/i/a88e4f/32.png) [@interscope101](https://discourse.nodered.org/u/interscope101)\
**Post date:** [17 January 2023 15:09 UTC](https://discourse.nodered.org/t/node-red-multiple-instances/73774/6 "2023-01-17T15:09:49Z")

</div>

Do I simply duplicate the "nodered.service" file and enable the same way as during the primary install?

```auto
sudo systemctl enable nodered.service

```

---

<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:** [17 January 2023 15:38 UTC](https://discourse.nodered.org/t/node-red-multiple-instances/73774/7 "2023-01-17T15:38:14Z")

</div>

> [@interscope101](#):
>
> Do I simply duplicate the "nodered.service" file

Yes, apart from making whatever changes are necessary to start the right instance, obviously.

---

<div class="post-metadata">

**Author:** ![interscope101](https://avatars.discourse-cdn.com/v4/letter/i/a88e4f/32.png) [@interscope101](https://discourse.nodered.org/u/interscope101)\
**Post date:** [17 January 2023 17:57 UTC](https://discourse.nodered.org/t/node-red-multiple-instances/73774/8 "2023-01-17T17:57:22Z")

</div>

Works - 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:** [18 March 2023 17:57 UTC](https://discourse.nodered.org/t/node-red-multiple-instances/73774/9 "2023-03-18T17:57:52Z")

</div>

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