Sinnigerweise bekommt auch die InfluxDB ein Update nach einer gewissen Zeit. Diese Datenbank nutze ich ja für (m)eine kleine Wetterstation zum Speichern der Daten und Darstellung mit Grafana. Nach dem Update auf die Version 1.8.9 will der Dienst auf meinem Wetter-Pi nicht mehr starten. Bei meinen Recherchen im Internet bin ich in einigen Foren fündig geworden, was auch mir geholfen hat. 

Das InfluxDB Update will nunmehr auch https unterstützen und ist für die neueste RaspiOS Version auf dem Raspberry Pi 4 zugeschnitten. Auf den RPi 2, so wie bei mir, will das aber nicht mehr so richtig gelingen. InfluxDB hat ein neues Startskript gestaltet, das zunächst mit den erforderlichen Rechten versehen werden muss.

sudo chmod +x /usr/lib/influxdb/scripts/influxd-systemd-start.sh

Dann muss der Inhalt derart angepasst werden, dass das Skript den Inhalt der vorigen Version 1.8.7 bekommt.

 

Startskript der Version 1.8.7

#!/bin/bash -e 
/usr/bin/influxd -config /etc/influxdb/influxdb.conf $INFLUXD_OPTS & 
echo $! > /var/lib/influxdb/influxd.pid 
BIND_ADDRESS=$(influxd config | grep -A5 "\[http\]" | grep '^ bind-address' | cut -d ' ' -f5 | tr -d '"') 
HOST=${BIND_ADDRESS%%:*} 
HOST=${HOST:-"localhost"} 
PORT=${BIND_ADDRESS##*:} 
set +e 
result=$(curl -s -o /dev/null http://$HOST:$PORT/health -w %{http_code}) 
while [ "$result" != "200" ]; 
do 
   sleep 1 
   result=$(curl -s -o /dev/null http://$HOST:$PORT/health -w %{http_code}) 
done 
set -e

 

So sieht das Skript der Version 1.8.9 aus

#!/bin/bash -e 
/usr/bin/influxd -config /etc/influxdb/influxdb.conf $INFLUXD_OPTS & 
PID=$! 
echo $PID >/var/lib/influxdb/influxd.pid 
PROTOCOL="http" 
BIND_ADDRESS=$(influxd config | grep -A5 "\[http\]" | grep '^ bind-address' | cut -d ' ' -f5 | tr -d '"') 
HTTPS_ENABLED_FOUND=$(influxd config | grep "https-enabled = true" | cut -d ' ' -f5) 
HTTPS_ENABLED=${HTTPS_ENABLED_FOUND:-"false"} 
if [ $HTTPS_ENABLED = "true" ]; then HTTPS_CERT=$(influxd config | grep "https-certificate" | cut -d ' ' -f5 | tr -d '"') 
   if [ ! -f "${HTTPS_CERT}" ]; then echo "${HTTPS_CERT} not found! Exiting..." 
      exit 1 
   fi 
   echo "$HTTPS_CERT found" 
   PROTOCOL="https" 
fi 
HOST=${BIND_ADDRESS%%:*} 
HOST=${HOST:-"localhost"} 
PORT=${BIND_ADDRESS##*:} 
set +e 
max_attempts=10 
url="$PROTOCOL://$HOST:$PORT/health" 
result=$(curl -k -s -o /dev/null $url -w %{http_code}) 
while [ "$result" != "200" ]; 
do 
   sleep 1 
   result=$(curl -k -s -o /dev/null $url -w %{http_code}) 
   max_attempts=$(($max_attempts-1)) 
   if [ $max_attempts -le 0 ]; then 
      echo "Failed to reach influxdb $PROTOCOL endpoint at $url" 
      exit 1 
   fi 
done 
set -e

Nun noch den Dienst starten und dauerhaft einschalten

sudo systemctl start influxdb.service sudo systemctl enable influxdb.service

Kontolle mit

sudo systemctl status influxdb.service

und sollte in etwa so aussehen “active (running)”

influxdb.service – InfluxDB is an open-source, distributed, time series database Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset: enabled) Active: active (running) since Sun 2021-08-15 23:43:58 CEST; 10h ago Docs: https://docs.influxdata.com/influxdb/ Process: 6033 ExecStart=/usr/lib/influxdb/scripts/influxd-systemd-start.sh (code=exited, status=0/SUCCESS) Main PID: 6034 (influxd) CGroup: /system.slice/influxdb.service └─6034 /usr/bin/influxd -config /etc/influxdb/influxdb.conf Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.

Danke an alle, die sich mit diesem Thema beschäftigen und in den letzten Tagen und Wochen ihre Lösungen veröffentlicht haben.

Linux Online-Monitoring per MQTT
HAM oddities

Kommentar hinterlassen

Your email address will not be published. Required fields are marked *

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.