I have a problem with InfluxDB running on Raspberry.
Initially I installed it following this tutorials: InfluxDB+Grafana persistence and graphing and InfluxDB+Grafana persistence and graphing - #86 by ThomDietrich
and everything was working perfectly. Signals from sensors were going to InfluxDB on the same Raspberry and I could view them with Grafana on my laptop. However, until the first reboot (sorry, did it by simply unplugging the power, but this must be permitted, since there can be and are electricity cut-offs and system must handle this without problems).
After reboot - no new data in the InfluxDB.
I found that the influxd service is not running:
openhabian@openhabian:~ $ influx Failed to connect to http://localhost:8086: Get http://localhost:8086/ping: dial tcp [::1]:8086: connect: connection refused Please check your connection settings and ensure 'influxd' is running.
Then, after some research I found problem with rights:
openhabian@openhabian:~ $ systemctl stop influxd openhabian@openhabian:~ $ /usr/bin/influxd -config /etc/influxdb/influxdb.conf &> /tmp/influxdb.log openhabian@openhabian:~ $ cat /tmp/influxdb.log ..... some lines here ... run: open server: open tsdb store: mkdir /var/lib/influxdb/data/_internal/_series: permission denied
Then I found possible solution here: docs.influxdata. com/influxdb/v1.8/troubleshooting/systemd/ (sorry, not allowed to insert more than two links) and here: github. com/influxdata/influxdb/issues/8912#issuecomment-431896205) (to change the owner of
influxdb). Tried but still error when tried to restart the service with
openhabian@openhabian:~ $ sudo chown -R influxdb:influxdb /var/lib/influxdb/* openhabian@openhabian:~ $ sudo systemctl restart influxdb.service Job for influxdb.service failed because the control process exited with error code. See "systemctl status influxdb.service" and "journalctl -xe" for details.
Rebooted the system - no luck. So I deleted the whole data (with
sudo rm -rf /var/lib/influxdb/).
Still not running. Then after tries and errors I found how to start the service:
openhabian@openhabian:~ $ sudo systemctl daemon-reload openhabian@openhabian:~ $ sudo systemctl enable influxdb.service openhabian@openhabian:~ $ sudo systemctl start influxdb.service openhabian@openhabian:~ $ influx Connected to http://localhost:8086 version 1.8.9 InfluxDB shell version: 1.8.9
Still do not understand why it simply doesn’t start itself after reboot - that was the idea of enabling the service with commands above, but instead I have to enter these commands again. And why
restart command doesn’t work but sequence above does work.
But OK, this is some progress…
I re-created all tables, gave access rights like in an initial tutorial but OH doesn’t write to Influx. Then I tried to write something to InfluxDB from CLI but can’t due to authorization problem:
openhabian@openhabian:~ $ influx -username openhab -password 'my_password' -host localhost Connected to http://localhost:8086 version 1.8.9 InfluxDB shell version: 1.8.9 > use test WARN: authorization failed Using database test > sine_wave value=0.0 ERR: authorization failed > exit
Tried also to write to DB from the python script: gist.github. com/ThomDietrich/ff836dbe0f0eaa2c5270a846a963893b) from the tutorial which worked fine after initial installation, but this time it returns with authorization error:
Failed to add point to influxdb (401) - aborting.
I’ve checked attributes:
openhabian@openhabian:~ $ cd /var/lib openhabian@openhabian:/var/lib $ ls -l influxdb total 16 drwxr-xr-x 3 influxdb influxdb 4096 Sep 13 16:37 data -rw-r--r-- 1 influxdb influxdb 5 Sep 14 13:41 influxd.pid drwxr-xr-x 2 influxdb influxdb 4096 Sep 14 01:39 meta drwx------ 3 influxdb influxdb 4096 Sep 13 16:37 wal openhabian@openhabian:/var/lib/influxdb/data $ sudo ls -l ./_internal/_series total 32 drwxr-xr-x 2 influxdb influxdb 4096 Sep 10 14:30 00 drwxr-xr-x 2 influxdb influxdb 4096 Sep 10 14:30 01 drwxr-xr-x 2 influxdb influxdb 4096 Sep 10 14:30 02 drwxr-xr-x 2 influxdb influxdb 4096 Sep 10 14:30 03 drwxr-xr-x 2 influxdb influxdb 4096 Sep 10 14:30 04 drwxr-xr-x 2 influxdb influxdb 4096 Sep 10 14:30 05 drwxr-xr-x 2 influxdb influxdb 4096 Sep 10 14:30 06 drwxr-xr-x 2 influxdb influxdb 4096 Sep 10 14:30 07
Now I need help, don’t know how to fix this issue. Seems this is an issue with access rights. I’m not strong in Linux and do not understand what should be sufficient rights (who should be the owner) since systemctrl starts the influx process.
I’d like to know how to fix this problem without re-installing influxdb from scratch, because re-installing won’t be a stable solution. In this case, I’ll fall into the same problem after any reboot.
P.S. My grafana connects to the database itself (so SELECT query works), but gets empty return.
P.P.S. Sorry, I understand that this question is not related to OpenHAB itself, but rather to Influx. But since I use it in context of OpenHAB and installed using tutorials from OpenHAB - I ask for help here.
- Platform information:
- Hardware: Raspberry Pi 3 Model B Plus Rev 1.3 / 1GB RAM / 32GB Flash
- OS: Raspbian GNU/Linux 10 (buster) / Linux 5.10.52-v7+
- Java Runtime Environment: which java platform is used and what version
- openHAB version: 3.1.0