Closed tcurdt closed 2 years ago
Using the wrong token gives a 401. So it seems to be connecting. Could it be there is a compatibility problem with version 2.1?
I'm not sure what the issue is with your setup, but here's a simple docker-compose.yml
file that worked for me. Hopefully this helps.
version: '3.7'
services:
node-red:
image: nodered/node-red:latest
ports:
- "1880:1880"
volumes:
- node-red-data:/data
# Define an InfluxDB v2 service
influxdb:
container_name: influxdb
ports:
- '8086:8086'
image: 'influxdb:2.1.1'
restart: unless-stopped
environment:
- DOCKER_INFLUXDB_INIT_MODE=setup
- DOCKER_INFLUXDB_INIT_USERNAME=root
- DOCKER_INFLUXDB_INIT_PASSWORD=password
- DOCKER_INFLUXDB_INIT_ORG=my-org
- DOCKER_INFLUXDB_INIT_BUCKET=my-bucket
volumes:
- influxdb2-data:/var/lib/influxdb2
volumes:
node-red-data:
influxdb2-data:
Here's a very simple flow to test output and queries. You'll have to add the token.
[
{
"id": "95ef4b8453127c9f",
"type": "inject",
"z": "f6f2187d.f17ca8",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 160,
"y": 220,
"wires": [
[
"e04a8bd6f6f09e02"
]
]
},
{
"id": "e04a8bd6f6f09e02",
"type": "influxdb out",
"z": "f6f2187d.f17ca8",
"influxdb": "db3bc7301913731b",
"name": "",
"measurement": "test",
"precision": "",
"retentionPolicy": "",
"database": "database",
"precisionV18FluxV20": "ms",
"retentionPolicyV18Flux": "",
"org": "my-org",
"bucket": "my-bucket",
"x": 470,
"y": 220,
"wires": []
},
{
"id": "1a9025ca08718481",
"type": "influxdb in",
"z": "f6f2187d.f17ca8",
"influxdb": "db3bc7301913731b",
"name": "test",
"query": "from(bucket: \"my-bucket\")\n |> range(start: -1m, stop: 1h)\n |> filter(fn: (r) => r._measurement == \"test\")",
"rawOutput": false,
"precision": "",
"retentionPolicy": "",
"org": "my-org",
"x": 270,
"y": 300,
"wires": [
[
"15a5e1039ebf4a6f"
]
]
},
{
"id": "15a5e1039ebf4a6f",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 430,
"y": 300,
"wires": []
},
{
"id": "957026f36bdad067",
"type": "inject",
"z": "f6f2187d.f17ca8",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 120,
"y": 300,
"wires": [
[
"1a9025ca08718481"
]
]
},
{
"id": "db3bc7301913731b",
"type": "influxdb",
"hostname": "127.0.0.1",
"port": "8086",
"protocol": "http",
"database": "database",
"name": "",
"usetls": false,
"tls": "",
"influxdbVersion": "2.0",
"url": "http://influxdb:8086",
"rejectUnauthorized": true
}
]
Odd. That very samedocker-compose
keeps restarting my influxdb.
Error: config name "default" already exists
Here is my full docker-compose
version: '3.7'
volumes:
influxdb_data:
nodered_data:
networks:
compose:
name: compose
services:
influxdb:
container_name: influxdb
image: influxdb:2.1.1-alpine
restart: unless-stopped
volumes:
- influxdb_data:/var/lib/influxdb2
environment:
- DOCKER_INFLUXDB_INIT_USERNAME=my-user
- DOCKER_INFLUXDB_INIT_PASSWORD=my-password
- DOCKER_INFLUXDB_INIT_ORG=my-org
- DOCKER_INFLUXDB_INIT_BUCKET=my-bucket
- DOCKER_INFLUXDB_INIT_RETENTION=14d
- INFLUXD_STORAGE_WAL_FSYNC_DELAY=15m
ports:
- 127.0.0.1:8086:8086
networks:
- compose
nodered:
container_name: nodered
image: nodered/node-red:2.2.1-16
restart: unless-stopped
environment:
- TZ=Europe/Berlin
volumes:
- nodered_data:/data
ports:
- 127.0.0.1:1880:1880
networks:
- compose
This time I used the root token from the UI. Same timeout. I am a bit flabbergasted.
I guess with it working for you it's at least not an incompatibility with 2.1.
I tried your setup and get the same errors now. The only significant difference is the environment variable INFLUXD_STORAGE_WAL_FSYNC_DELAY
. I am not sure what this does or why you need it. I commented it out and it seems to solve the problem. Give that a try.
Yes, I've tested it with Influxdb 2.1 and its not a compatibility issue. I don't think this is a bug in the node. I'll close this for now, but if you become convinced it's a bug, feel free to reopen it.
This should cause the underlying the storage layer to fsync less. The idea was to go easier on the SD card.
Now - that's just crazy! Thanks for helping in debugging this. It didn't even cross my mind this could be related.
🙏
I am trying to write into
influxdb:2.1.1-alpine
but getting a timeout and cannot figure out the reason why.From the
nodered/node-red:2.2.1-16
containercurl http://influxdb:8086
works just fine. This suggests network connectivity is OK.This is how I started the influxdb container:
I am using the token from
influx auth list
- which is also provided in the example available through the UI.The node is configured as such:
I don't see a problem - yet the write fails:
Any idea what could be the problem? I didn't find anything related in the open issues.