Skip to content

Instantly share code, notes, and snippets.

@edison7500
Forked from boseji/Rpi-InfluxDB-Install.md
Created October 26, 2019 04:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edison7500/2441e522da9bc81799d4c2fa01ce05c6 to your computer and use it in GitHub Desktop.
Save edison7500/2441e522da9bc81799d4c2fa01ce05c6 to your computer and use it in GitHub Desktop.
Raspberry Pi InfluxDB installation

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.

Installing InfluxDB in Raspbian

Adding Repository Key for InfluxDB

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.

Adding Repository URL for InfuxDB

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.

For jessie or Debian 8.0

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

For wheezy or Debian 7.0

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

In case any of the above two fail !!

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.

Installing InfluxDB

The actual install is pretty much the same as any other package from apt.

sudo apt-get install influxdb

Combined Commands : Installing InfluxDB

If you are really know what you want and want, here is a combined list of commands for the respective OS distros.

For jessie or Debian 8.0

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

For wheezy or Debian 7.0

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

Firewall configuration (OPTIONAL)

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.

Configure InfluxDB Admin Interface

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.

Start the InfluxDB

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

Also same using systemd

sudo systemctl start influxdb

and

sudo systemctl restart influxdb

........................

Hope to add more sections as I find more information - Please comment and post updates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment