InfluxDB is an open source time-series database (TSDB), written in Go and optimised for fast, high-availability storage and retrieval of time series data in fields such as operations monitoring, application metrics, Internet of Things sensor data, and real-time analytics.
In this blog post, you will learn how to install InfluxDB and create an InfluxDB database in order to store data coming from MQTT through Node-RED.
Node-RED is a programming tool for connecting together hardware devices, APIs and online services in new and interesting ways.
It provides a browser-based editor that makes it easy to wire flows using the wide range of nodes in the palette that can be deployed to its runtime in a single-click.
What is InfluxDB used of?
InfluxDB is a time series platform that enables developers to build IoT, analytics and monitoring software.
It is designed to handle the massive volumes and countless sources of time-stamped data produced by sensors, applications and infrastructure.
What is MQTT?
Now that you know a little bit more about the tools that you are going to use, you are going to install InfluxDB on your Raspberry Pi industrial PLC.
1. First of all, update the aptitude package:
sudo apt update
wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add -
3. Add the repository to the sources list
echo "deb https://repos.influxdata.com/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
4. Update the package list again.
sudo apt update
5. Install InfluxDB onto your open source PLC Raspberry Pi:
sudo apt install influxdb
6. Enable InfluxDB to start at boot on your Raspberry Pi automation.sudo systemctl unmask influxdb
sudo systemctl enable influxdb
sudo systemctl start influxdb
Finally, start InfluxDB by typing influx in the commandline of your Raspberry PLC:
How to create an InfluxDB database
As InfluxDB comes without any database by default, you are going to create the first one, called test. Into this influx prompt, follow the next steps:
1. Create a database called test
create database test
2. Go into the database:use test
3. Now, you will show everything from the database with the command below. You will see that obviously is empty. You just do this step in order to make sure what it contains right now.select * from test
Now that you have created your first database with InfluxDB, let's insert data from Node-RED!
Want to know how?