How-to
Node-RED FTP CSV to InfluxDB: staged data path setup
Short answer
Treat the FTP-to-InfluxDB path as three stages with separate success boundaries: retrieving the CSV, parsing its values and timestamps, and writing points to the bucket over TCP port 8086 with the node connection on version 2.0. Commission in that order, confirm the raw points in Data explorer, and enable either delete control only after the write is proven.

On this page
A CSV file that lands on the edge host proves the FTP path and nothing else. Retrieval, parsing and the InfluxDB write are three separate operations with three separate failure points, so commission them in that order: list the remote directory, retrieve one known file, read the parsed values and timestamps in the debug pane, and only then confirm the points in the bucket. Either delete control stays off until that write is proven. This article builds the path with node-red-contrib-ftp, node-red-contrib-influxdb and node-red-contrib-fs, with the write node's connection on version 2.0 and the database's default TCP port 8086.
What each stage proves #
| Stage | Success proves | It does not prove |
|---|---|---|
| FTP retrieval | Credentials, the control channel and the data channel all work | That the file parsed or reached the database |
| CSV parsing | Columns and timestamps became message fields | That any point was written |
| InfluxDB write | Token, organization, bucket and point format were accepted | That the source files may be deleted |
A green message on the retrieval node answers the FTP question only. A flow can download files all day into a bucket that never receives a point, and the usual causes sit on the database side: a rejected token, a mis-spelled organization or a point format the write node rejects. Judge each boundary with its own test, never with the previous test's success.
Prepare the InfluxDB destination #
- Complete the database's initial setup: username, password, organization name and the initial bucket.
- Create the ingestion bucket with Create bucket; this workflow names it csv-ingest.
- Under Load Data, open API Tokens and use Generate API Token. An All access API Token is acceptable for commissioning; store it outside the flow.
- Generate a second, custom token that grants write on csv-ingest only; that is the token the continuous flow runs on.
- In the write node's connection settings, select version 2.0 and enter the database host URL with its default port 8086, the organization exactly as entered during setup, the bucket and the token. The screen-by-screen detail is in Connect Node-RED to InfluxDB 2.6 with the v2 API.
The boundaries differ: a wrong organization writes into the wrong tenant, a wrong bucket points the records at another destination, and a rejected token stops every write with an authorization error. Keep every token out of exported flows and debug output.
Install the Node-RED nodes #
When the ingestion host itself is still to be chosen, an industrial mini PC sized for continuous Node-RED and InfluxDB duty keeps retrieval, parsing and storage in one cabinet box.
- With internet access on the host, open Manage palette and use Install.
- Install node-red-contrib-ftp, node-red-contrib-influxdb and node-red-contrib-fs.
- If a prepared flow JSON is available, use Import and Select a file to import, then confirm that no node reports a missing package.
- Deploy so the new nodes are active.
A palette installation installs no logic. Keep retrieval, parsing, writing and cleanup as separately observable stages in the flow, each with a debug node at its boundary.
Configure retrieval, local copies and parsing #
The FTP nodes share one configuration: server address, port, username and password, with the remote directory set in each node's filename field. FTP's default control port is 21, but every listing and transfer opens a second, negotiated data connection; a login that succeeds while the listing hangs or fails is a data-channel problem, so check the server's passive-mode configuration and any filtering between host and controller.
Conventional FTP carries the password and the file content unencrypted; keep this path on a segmented OT network and never expose the controller's FTP service beyond it.
Point the local copies at host-mapped storage. A Node-RED that runs in a container and writes into the container's own filesystem loses those copies when the container is rebuilt — the same trap the fix in Node-RED in Docker must write to host storage, not the container describes. If the storage folder changes later, update every node that checks the path, lists the folder or builds the file URL, or the cleanup branch will look in the old place.
Parsing is two nodes: the CSV node turns each row into message fields, and a function node builds one point per row with its own value and timestamp. A many-row file must reach the write node as an array of points; sent as a single record it can collapse, and InfluxDB keeps only the last one — the mechanism is set out in Why InfluxDB keeps only the last record of a Node-RED array write.
Commission the path in order #
- List the remote directory. Run the list node on its own. A listing proves the address, the port, the credentials and the directory permission. Credentials that fail here are an FTP account problem; a login that succeeds without a listing is the data channel.
- Retrieve one known CSV. Pick a small file whose content you know. A completed transfer proves the data channel; check the received size and the first line against the source.
- Read the parsed debug output. One known row must appear with an identical value and a timestamp in the expected time zone. InfluxDB stores timestamps as UTC, so local plant time is converted before the write.
- Confirm the write in Data explorer. Select the csv-ingest bucket, pick the field, set the window period to Custom — 1ms for millisecond-spaced rows — leave the aggregate function empty so raw points are shown, and press Submit.
- Count before you delete. Enable the delete controls only after the count matches, one control at a time.
Worked example: a CSV written once per second for ten minutes carries 10 × 60 = 600 rows, so Data explorer must return 600 points for that field over that window. Six hundred points means parse and write are correct; a single point means the array collapsed; zero means the write never ran, and the cause sits in the node connection rather than in the FTP node.
The go and no-go for each stage #
- Retrieval: go when the listing and one file transfer both complete; no-go when either hangs, which points at the passive-mode configuration rather than at the flow logic.
- Parsing: go when a known row appears in debug with the right value and hour; no-go when fields arrive empty or shifted, which means the CSV mapping or the UTC conversion needs fixing before anything is written.
- Write: go when the point count equals the row count; no-go on an authorization error, checked in this order: token, organization, bucket.
- Delete remote CSVs: enable only after the write is proven, and read the deletion list first. For example, 300 files at 15 KB each amount to 300 × 15 KB = 4500 KB, about 4.4 MB that must already exist in the bucket as points.
- Delete local copies: the same rule; the branch sends an HTTP request to the host's file API with host credentials, so confirm the address matches the host and the folder matches the path the storage nodes use.
For continuous running, replace the commissioning token with the write-scoped one and re-run the Data explorer check once. If the database link drops mid-batch, buffering and recovery decide what the bucket finally contains; the behavior is set out in Fix Node-RED InfluxDB write errors after a network outage.
Questions asked
Which port does the InfluxDB write node need?
InfluxDB 2.x listens on TCP port 8086 by default, so the node connection uses the database host address with that port. If the service was installed on a different port, enter that port instead, and test reachability first: a reachable port proves the service answers, not that the token will be accepted.
How does a multi-row CSV become multiple points?
Parse the file, build one point per row in a function node, each with its own field value and timestamp, and pass the whole array to the write node. Afterward, compare the row count with the point count for that field; if only one point appears, the array was collapsed to its last record.
The FTP login succeeds but the directory listing fails. Why?
FTP uses two connections: a control session for commands and a separate data connection for listings and transfers. A successful login with a failing or hanging listing means the data connection is blocked. Check the server's passive-mode configuration and open the negotiated data port range on the filtering device between host and controller.
Which API token should continuous production use?
Commissioning can run on an all-access token, but continuous deployment should use a token that grants write to the ingestion bucket only. Generate the scoped token from the same API Tokens screen, update the node connection, confirm one test write, then retire the broad token, and keep both out of exported flows.
Why do the stored points show the wrong hour?
InfluxDB stores timestamps as UTC. If the CSV rows carry local plant time, convert them before the write, or each point lands a fixed offset away from the event it records. Verify one known row against its stored timestamp before trusting the whole series.

