Raspberry pi stops sending data to influxdb when ethernet cable is disconnected

I have a sensor mounted on my raspberry pi (rpi) [64bit OS] and I use node red to collect data from the rpi serial port and send it to influxdb database installed on the rpi through a docker container. I've noticed that when I unplug the ethernet cable from the rpi, it stops the sending of data to influxdb. I see another post with a similar problem where it was recommended to put "localhost" in the influxdb node. I did as per below:

image

But then I get this error:

"FetchError: request to http://localhost:8086/api/v2/query?org=Home failed, reason: connect ECONNREFUSED 127.0.0.1:8086".

I also notice that after running node red on the rpi for a while, my house network slows down considerably. The node red graphical UI also stops working. But when I disconnect the ethernet network cable from the rpi, the network is back up again.

Please note that I'm using the stachero influxdb v2 node.

Why do you need to unplug the Ethernet cable?

???

Have you done any analysis on what is using network traffic? Also, what do you mean - the network from the Pi slows down or ALL traffic on the network slows down?

Then you need to look at what is happening on the network. I've run multiple instances of Node-RED on different platforms for years now without any network issues at all.

Have you checked to make sure it isn't Docker causing issues?

There shouldn't be any difference really between "localhost" and 127.0.0.1, they are the same thing.

If InfluxDB is in a different Docker container then it won't be localhost, it will be something else depending on the Docker configuration.

The cable was actually unplugged [by mistake] in the morning. When I came back in the afternoon I could not connect and realised it was unplugged. I then noticed that data was not captured during the day. I plugged it back but 30min little later, I realised that my home network slowed down significantly. I also kept on loosing connection to the rpi as well. I intuitively unplugged the ethernet cable and my home network was up again. So for some reason the rpi is routing the data through the LAN ...

What did you change it from when you set it to localhost?

I changed it from 192.168.8.142

That is probably the lan address of your Pi. That's why your InfluxDB goes offline.

If it is running on the same Pi, you should be using localhost.

With influx running in Docker is there something that has to be done to allow local access as localhost? Or does the container have an IP address?

Hey Colin. You are right. Good tip. Docker composer has created a network linking the various containers each with its own IP address. I put in the IP address of the influxdb container and it is now working. I can unplug my cable and no issues, it carries on recording. Problem solved.

if you are using compose then it should also create it's own local dns lookup based on the name of the image - so you should be able to use that as well - in case the ip does change for some reason.

That's what I told you in my first post.

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