EMFILE Error with Influxdb

I meant can you access the influxdb server using an alternative means. However a port scan of the ip address you previously posted suggests that port 8086 is not open.

Hi Colin

I just ran a port scan using nmap which seems to show that port 8086 is open...showing the following:

Host is up (0.060s latency).
Not shown: 996 filtered ports
PORT STATE SERVICE
22/tcp open ssh
3389/tcp closed ms-wbt-server
8083/tcp closed us-srv
8086/tcp open d-s-n

I am definitely no expert on this and not sure waht the d-s-n means next to it either.

When you say access the server using an alternative means can you explain a bit further. I can SSH into the machine ok if thats what you mean.

You are right, the port is open, my mistake, I only ran a limited scan.
I meant can you access the influx database from the machine running node-red by some means other than node-red? That would tell you whether it is a node-red issue or a connection or influx issue.
Did I ask you to look at the influxdb log on the server to see if they say anything? If not then that would be a good plan.

I have tried to write data to the influx database from the command line but it says operation time out so it must have something to do with the connection to the machine.

Not sure how to access the influxdb logs, the documentation seems a bit confusing.

Where the log is depends on how it is run. Often it will be in /var/log/influxdb.

There seems to be a lot of files there:

alternatives.log auth.log.2.gz daemon.log.1 dpkg.log kern.log.1 messages.1 syslog.1 syslog.6.gz
alternatives.log.1 auth.log.3.gz daemon.log.2.gz dpkg.log.1 kern.log.2.gz messages.2.gz syslog.2.gz syslog.7.gz
apt btmp daemon.log.3.gz faillog kern.log.3.gz messages.3.gz syslog.3.gz unattended-upgrades
auth.log btmp.1 debug influxdb lastlog ntpstats syslog.4.gz wtmp
auth.log.1 daemon.log debug.1 kern.log messages syslog syslog.5.gz wtmp.1

Which one would it be?

Thats probably a question for an influxdb forum?

Oddly enough it's probably the one called influxdb, which is what I said. That is likely a folder.

correct, it is a folder rather than a file but the folder is empty

It could just be in /var/log/syslog along with all the other system stuff.

I have now established that the connection to influxdb is working ok. I managed to insert data into a test database using the http request from my local machine so it looks like the error is on the node red side.

One thing that I suspect is an issue is that I am trying to write a large amount of data (approx 11k lines) and in the influx documentation it states:

Note: If your data file has more than 5,000 points, it may be necessary to split that file into several files in order to write your data in batches to InfluxDB. By default, the HTTP request times out after five seconds. InfluxDB will still attempt to write the points after that time out but there will be no confirmation that they were successfully written.

So I think my issue is related to this. Any suggestions on how I might break up my messages into batches smaller than 5k?

I would first confirm that you can write small amounts of data ok from node-red.

Yes I have done that too, also to the same test databse so I know the node red connection works too (for a single line of data)

OK, what is the form of the data you want to split up?
Could you provide a mini-flow that generates some sample data that we can work out how to split?

Hi,
I am experiencing the same problem as reported in the topic.

Trying to save over 6000 data to influxDB I get the error:
Node-RED[14245]: 14 Jul 09:18:05 - [error] [http request:POST to influxdb] Error: connect EMFILE - Local (undefined:undefined)

The error occurs exactly after saving exaclty 4081 values.

I have tried to divide the sending of data to influxDB into blocks of 1000 values, however I get exactly the same result.

As shown in the screenshot, the 'convert for influxdb' node receives the data, splits it into blocks of 1000 and sends it to the 'Post to influxDB' node, the 'check finish' function triggers the 'convert for influxdb' node again until all the data has been processed.

Has a solution been found for this error?
What is meant by "splitting" the data, an operation suggested in the topic to solve the error?

Thank you for your support.
Fabrizio

Welcome to the forum @FabriLog

Googling for the error shows that means that the OS is denying your program requests to open more files/sockets, which suggests that possibly the sockets are not being closed for some reason. Can you export that section of the flow and paste it here. See this post for how to post flows - How to share code or flow json