# Sharing global variable across multiple instances

**URL:** <https://discourse.nodered.org/t/sharing-global-variable-across-multiple-instances/99781>\
**Category:** Dashboard\
**Tags:** mqtt\
**Created:** [26 November 2025 18:35 UTC](https://discourse.nodered.org/t/sharing-global-variable-across-multiple-instances/99781 "2025-11-26T18:35:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![michaelbusry](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@michaelbusry](https://discourse.nodered.org/u/michaelbusry)\
**Post date:** [26 November 2025 18:35 UTC](https://discourse.nodered.org/t/sharing-global-variable-across-multiple-instances/99781/1 "2025-11-26T18:35:46Z")

</div>

I have been given the task of refactoring out flows into multiple instances. What I found is there are many global variables that the different flows use. I'm looking for the easiest way to share my globals with the four different instances. Any ideas? I have a great many to do within nodes and function code.

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [26 November 2025 18:42 UTC](https://discourse.nodered.org/t/sharing-global-variable-across-multiple-instances/99781/2 "2025-11-26T18:42:04Z")

</div>

If the instances are on the same network then a common database would be one solution.  
In other words use a database instead of global variables.

---

<div class="post-metadata">

**Author:** ![michaelbusry](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@michaelbusry](https://discourse.nodered.org/u/michaelbusry)\
**Post date:** [26 November 2025 18:55 UTC](https://discourse.nodered.org/t/sharing-global-variable-across-multiple-instances/99781/3 "2025-11-26T18:55:36Z")

</div>

I thought about that but my boss is wanting me to use MQTT since it's installed and we don't have many options for this client.

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [26 November 2025 19:24 UTC](https://discourse.nodered.org/t/sharing-global-variable-across-multiple-instances/99781/4 "2025-11-26T19:24:50Z")

</div>

> [@michaelbusry](#):
>
> I thought about that but my boss is wanting me to use MQTT

Using persistence in MQTT is also a possibility.

---

<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:** [26 November 2025 20:03 UTC](https://discourse.nodered.org/t/sharing-global-variable-across-multiple-instances/99781/5 "2025-11-26T20:03:42Z")

</div>

> [@michaelbusry](#):
>
> my boss is wanting me to use MQTT

That is how I would do it.

---

<div class="post-metadata">

**Author:** ![michaelbusry](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@michaelbusry](https://discourse.nodered.org/u/michaelbusry)\
**Post date:** [17 December 2025 19:21 UTC](https://discourse.nodered.org/t/sharing-global-variable-across-multiple-instances/99781/6 "2025-12-17T19:21:31Z")

</div>

Thanks, that's what was decided on.

---

<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:** [16 January 2026 19:21 UTC](https://discourse.nodered.org/t/sharing-global-variable-across-multiple-instances/99781/7 "2026-01-16T19:21:33Z")

</div>

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