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

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.

1 Like

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?

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:

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

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

Then:

sudo systemctl daemon-reload
sudo systemctl start influxdb

The influxdb out node now runs without errors.

2 Likes

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

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