IoT - InfluxDB - Setup

Logbook for basic setup of InfluxDB 1.02 on Raspberry Pi 3

Influx DB installieren

 curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/os-release
test $VERSION_ID = "7" && echo "deb https://repos.influxdata.com/debian wheezy stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
test $VERSION_ID = "8" && echo "deb https://repos.influxdata.com/debian jessie stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
test $VERSION_ID = "9" && echo "deb https://repos.influxdata.com/debian stretch stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo apt-get update
sudo apt-get install influxdb
sudo service influxdb start
sudo apt-get install influxdb-client

Launch influx shell

influx -precision rfc3339

Create iot database

create database iot

Create users

 CREATE USER "dl2sba" WITH PASSWORD 'password' WITH ALL PRIVILEGES
CREATE USER "node-red" WITH PASSWORD 'password'
GRANT ALL ON "iot" TO "node-red"

Check health of SSD

sudo smartctl -xaH /dev/sda
sudo badblocks -v /dev/sda

Relocate existing InfluxDB

Stop Daemon

sudo service influxdb stop

Edit config file

sudo vi /etc/influxdb/influxdb.conf

[meta]
# Where the metadata/raft database is stored
# dir = "/var/lib/influxdb/meta"
dir = "/influx-db/influxdb/meta"

[data]
# Controls if this node holds time series data shards in the cluster
enabled = true
# dir = "/var/lib/influxdb/data"
dir = "/influx-db/influxdb/data"
# These are the WAL settings for the storage engine >= 0.9.3
# wal-dir = "/var/lib/influxdb/wal"
wal-dir = "/influx-db/influxdb/wal"

Copy directory content

sudo cp -R --preserve=all /var/lib/influxdb /influx-db
sudo mv /var/lib/influxdb /var/lib/influxdb-old

Restart daemon

sudo service influxdb start

Backup InfluxDB

influxd backup /home/dietmar/dev/influx-backup/
influxd backup -database iot /home/dietmar/dev/influx-backup/