# ECONNREFUSED errors when writing data to influxDB with node-red-contrib-influxdb

**URL:** <https://discourse.nodered.org/t/econnrefused-errors-when-writing-data-to-influxdb-with-node-red-contrib-influxdb/50307>\
**Category:** General\
**Created:** [27 August 2021 23:53 UTC](https://discourse.nodered.org/t/econnrefused-errors-when-writing-data-to-influxdb-with-node-red-contrib-influxdb/50307 "2021-08-27T23:53:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnMM](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/johnmm/32/47112_2.png) [@JohnMM](https://discourse.nodered.org/u/JohnMM)\
**Post date:** [27 August 2021 23:53 UTC](https://discourse.nodered.org/t/econnrefused-errors-when-writing-data-to-influxdb-with-node-red-contrib-influxdb/50307/1 "2021-08-27T23:53:57Z")

</div>

I have Node-Red and InfluxDB installed on Ubuntu:

Ubuntu 20.04.3 LTS  
Node-RED 2.0.5  
InfluxDB 1.8.9  
node-red-contrib-influxdb 0.6.1

When I write data to the **influxdb out** node I get a ECONNREFUSED error after a number of successful writes.

If I write the data at a fixed frequency (eg every 5 seconds or every 2 seconds) then I get the error after every 21 writes.

If I write date with a random frequency then I get the error after a variable number of writes but I can't see a relationship between the (random) frequency and the number of writes before I get an error.

The error message is: _Error: connect ECONNREFUSED 127.0.0.1:8086_

Does anyone have any idea what the problem might be?

Thanks.

---

<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:** [28 August 2021 05:43 UTC](https://discourse.nodered.org/t/econnrefused-errors-when-writing-data-to-influxdb-with-node-red-contrib-influxdb/50307/2 "2021-08-28T05:43:04Z")

</div>

Very odd.

Check the influx log to see if anything helpful there.

If you go into the influx out node and click on the server drop-down how many entries do you see?

---

<div class="post-metadata">

**Author:** ![JohnMM](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/johnmm/32/47112_2.png) [@JohnMM](https://discourse.nodered.org/u/JohnMM)\
**Post date:** [30 August 2021 07:12 UTC](https://discourse.nodered.org/t/econnrefused-errors-when-writing-data-to-influxdb-with-node-red-contrib-influxdb/50307/3 "2021-08-30T07:12:19Z")

</div>

> click on the server drop-down how many entries do you see?

I have 2 configurations in the server drop-down. I'm using `localhost:8086`. influxDB is running on the same server as Node-RED.

In `syslog` I see the `influxdb.service` continuously restarting:

```auto
Aug 28 07:15:36 klomar-Inspiron-3668 influxd-systemd-start.sh[26638]: [httpd] 127.0.0.1 - admin [28/Aug/2021:07:15:36 +0100] "POST /write?db=sensors&p=%5BREDACTED%5D&precision=n&rp=&u=admin HTTP/1.1 " 204 0 "-" "-" 5bcb706e-07c7-11ec-801c-484d7eb95aef 3290
Aug 28 07:15:36 klomar-Inspiron-3668 influxd-systemd-start.sh[26638]: [httpd] 127.0.0.1 - admin [28/Aug/2021:07:15:36 +0100] "POST /write?db=sensors&p=%5BREDACTED%5D&precision=n&rp=&u=admin HTTP/1.1 " 204 0 "-" "-" 5bcc2958-07c7-11ec-801d-484d7eb95aef 3335
Aug 28 07:15:36 klomar-Inspiron-3668 influxd-systemd-start.sh[26638]: [httpd] 127.0.0.1 - - [28/Aug/2021:07:15:36 +0100] "GET /health HTTP/1.1" 401 55 "-" "curl/7.68.0" 5bce328f-07c7-11ec-801e-484d7eb95aef 51
Aug 28 07:15:36 klomar-Inspiron-3668 influxd-systemd-start.sh[26637]: Failed to reach influxdb http endpoint at http://localhost:8086/health
Aug 28 07:15:36 klomar-Inspiron-3668 systemd[1]: influxdb.service: Control process exited, code=exited, status=1/FAILURE
Aug 28 07:15:36 klomar-Inspiron-3668 influxd-systemd-start.sh[26638]: ts=2021-08-28T06:15:36.178114Z lvl=info msg="Signal received, initializing clean shutdown..." log_id=0WErDlNG000
Aug 28 07:15:36 klomar-Inspiron-3668 influxd-systemd-start.sh[26638]: ts=2021-08-28T06:15:36.178132Z lvl=info msg="Waiting for clean shutdown..." log_id=0WErDlNG000
Aug 28 07:15:36 klomar-Inspiron-3668 influxd-systemd-start.sh[26638]: [tcp] 2021/08/28 07:15:36 tcp.Mux: Listener at 127.0.0.1:8088 failed failed to accept a connection, closing all listeners - accept tcp 127.0.0.1:8088: use of closed network connection
Aug 28 07:15:36 klomar-Inspiron-3668 influxd-systemd-start.sh[26638]: ts=2021-08-28T06:15:36.178207Z lvl=info msg="Listener closed" log_id=0WErDlNG000 service=snapshot
Aug 28 07:15:36 klomar-Inspiron-3668 influxd-systemd-start.sh[26638]: ts=2021-08-28T06:15:36.178229Z lvl=info msg="Shutting down monitor service" log_id=0WErDlNG000 service=monitor
Aug 28 07:15:36 klomar-Inspiron-3668 influxd-systemd-start.sh[26638]: ts=2021-08-28T06:15:36.178239Z lvl=info msg="Terminating storage of statistics" log_id=0WErDlNG000 service=monitor
Aug 28 07:15:36 klomar-Inspiron-3668 influxd-systemd-start.sh[26638]: ts=2021-08-28T06:15:36.178254Z lvl=info msg="Terminating precreation service" log_id=0WErDlNG000 service=shard-precreation
Aug 28 07:15:36 klomar-Inspiron-3668 influxd-systemd-start.sh[26638]: ts=2021-08-28T06:15:36.178268Z lvl=info msg="Terminating continuous query service" log_id=0WErDlNG000 service=continuous_querier
Aug 28 07:15:36 klomar-Inspiron-3668 influxd-systemd-start.sh[26638]: ts=2021-08-28T06:15:36.178297Z lvl=info msg="Closing retention policy enforcement service" log_id=0WErDlNG000 service=retention
Aug 28 07:15:36 klomar-Inspiron-3668 influxd-systemd-start.sh[26638]: ts=2021-08-28T06:15:36.178701Z lvl=info msg="Closed service" log_id=0WErDlNG000 service=subscriber
Aug 28 07:15:36 klomar-Inspiron-3668 influxd-systemd-start.sh[26638]: ts=2021-08-28T06:15:36.178732Z lvl=info msg="Server shutdown completed" log_id=0WErDlNG000
Aug 28 07:15:36 klomar-Inspiron-3668 systemd[1]: influxdb.service: Failed with result 'exit-code'.
Aug 28 07:15:36 klomar-Inspiron-3668 systemd[1]: Failed to start InfluxDB is an open-source, distributed, time series database.
Aug 28 07:15:36 klomar-Inspiron-3668 systemd[1]: influxdb.service: Scheduled restart job, restart counter is at 358.
Aug 28 07:15:36 klomar-Inspiron-3668 systemd[1]: Stopped InfluxDB is an open-source, distributed, time series database.
Aug 28 07:15:36 klomar-Inspiron-3668 systemd[1]: Starting InfluxDB is an open-source, distributed, time series database...
Aug 28 07:15:36 klomar-Inspiron-3668 influxd-systemd-start.sh[26710]: Merging with configuration at: /etc/influxdb/influxdb.conf
Aug 28 07:15:36 klomar-Inspiron-3668 influxd-systemd-start.sh[26708]: ts=2021-08-28T06:15:36.544815Z lvl=info msg="InfluxDB starting" log_id=0WErEPO0000 version=1.8.9 branch=1.8 commit=d9b56321d579

```

Ths seems to be caused by a bug introduced in Influxdb v1.8.7  
see: [GitHub Issue](https://github.com/influxdata/influxdb/issues/21967)

I 'fixed' it by editing `/etc/systemd/system/influxd.service` and commenting out `Type=forking`.

Then:

```auto
sudo systemctl daemon-reload
sudo systemctl start influxdb

```

The **influxdb out** node now runs without errors.

---

<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:** [30 August 2021 09:56 UTC](https://discourse.nodered.org/t/econnrefused-errors-when-writing-data-to-influxdb-with-node-red-contrib-influxdb/50307/4 "2021-08-30T09:56:41Z")

</div>

> [@JohnMM](#):
>
> I have 2 configurations in the server drop-down

If they l both have the same settings then remove one of them. You don't need two connections to the server.

---

<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:** [13 September 2021 09:56 UTC](https://discourse.nodered.org/t/econnrefused-errors-when-writing-data-to-influxdb-with-node-red-contrib-influxdb/50307/5 "2021-09-13T09:56:44Z")

</div>

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