Raspberry Pi InfluxDB: The solution for IoT Data storage
Raspberry Pi is costeffect linux computer very commonly used for IoT home automation projects.
Here are the 3 problems with conventional databases for IoT data store applications:
- Too much or complex configuration
- Unable to expire data / set retentional policies
- Not tailor made of Time Series Data
Thankfully the easy to use InfluxDB solves all these problems and provides much more.
First we need to add the Repository Key for InfluxDB to the installation.
For this fire up a Shell terminal via putty
or ssh pi@raspberrypi
to your favorite Raspberry Pi on the network.
Instead if you are lucky to have a montor connected then just open Lxterminal
utility from the desktop.
curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
This command would install the keys.
Next we need to add the required repository.
For this we need to know what is the release (OS version) we are working on.
lsb_release -a
For this command you would get some output like:
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 8.0 (jessie)
Release: 8.0
Codename: jessie
Here the version of OS is jessie
or Debian 8.0
.
In some cases it might be also wheezy
or Debian 7.0
the older version of the OS.
This information about the OS would be used to determin what command we use next.
sudo apt install apt-transport-https
echo "deb https://repos.influxdata.com/debian jessie stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo apt update
sudo apt install apt-transport-https
echo "deb https://repos.influxdata.com/debian wheezy stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo apt update
The https:\\
is not enabled in the default apt
install for Rasberry Pi.
In order to enable that we use:
sudo apt install apt-transport-https
This would install the support, then go ahead a execute the above commands.
The actual install is pretty much the same as any other package from apt
.
sudo apt-get install influxdb
If you are really know what you want and want, here is a combined list of commands for the respective OS distros.
sudo apt-get update && sudo apt install apt-transport-https curl
curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
echo "deb https://repos.influxdata.com/debian jessie stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo apt-get update && sudo apt-get install influxdb
sudo apt-get update && sudo apt install apt-transport-https curl
curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
echo "deb https://repos.influxdata.com/debian wheezy stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo apt-get update && sudo apt-get install influxdb
In you you have firewall like ufw
enabled then you would need to open up the Admin port for the database.
Use the following commands
sudo ufw stats verbose # Just check if we have the firewall running
sudo ufw allow from {Subnet/IPaddress} to any port 8083 proto tcp
Replace the {Subnet/IPaddress}
with the
required Sub-net like 192.168.1.0/24
or
a specific IP Address like 192.168.1.12
This would enable the Admin Port for the InfluxDB webinterface through the firewall.
In order to configure the internals of the InfluxDB operation one needs to modify the influxdb.conf
file in the /etc/influxdb
directory.
Open this file in any of your editors, like here in nano:
sudo nano -c /etc/influxdb/influxdb.conf
Edit the specific segment:
.....
###
### Controls the availability of the built-in, web-based admin interface. If HTTPS is
### enabled for the admin interface, HTTPS must also be enabled on the [http] service.
###
### NOTE: This interface is deprecated as of 1.1.0 and will be removed in a future release.
[admin]
# Determines whether the admin service is enabled.
enabled = true
# The default bind address used by the admin service.
bind-address = ":8083"
# Whether the admin service should use HTTPS.
# https-enabled = false
.....
The line:189
of influxdb.conf
file has the feature to enable the admin interface.
This line needs to be uncommented and changed to enalbled = true
Next to observe at line:192
of influxdb.conf
file, this specifies the port number.
This line needs to be uncommented and changed to bind-address = ":8083"
That would do the needful to configure the admin interace.
Starting the database is a straightforward command:
sudo service influxdb start
In case you would like to restart after some modifications to config:
sudo service influxdb restart
sudo systemctl start influxdb
and
sudo systemctl restart influxdb
........................
Hope to add more sections as I find more information - Please comment and post updates
Then I found this info telling me to use chronograf, but their links are not ok anymore either. Where should I go for the admin panel?