In this Raspberry Pi InfluxDB tutorial, we will show you how to configure and install InfluxDB for the Raspbian operating system.

We'll also show you how to enable authentication on your InfluxDB server to improve its security, and we'll show you how to interact with the database from the command line.
For those who wonderwhat is influxdb, is a database system based on time series. This means that every data point in the database contains a timestamp.
Because it is based on time series, InfluxDB is one of the best databases for monitoring metrics and events. You can easily use InfluxDB to store information like the temperature in a room or the CPU usage of a system.
InfluxDB is the perfect database software that together withpopular Grafana visualization tool🇧🇷 Grafana has built-in support for displaying data from an InfluxDB database.
gear
Below you will find all the equipment needed to set up InfluxDB on your Raspberry Pi.
recommended
- Raspberry Pi
- micro sd card
- power supply
- cabo de ethernetoW-LAN
Optional
- usb keyboard
- USB-Maus
- cabo HDMI
Installing InfluxDB on Raspberry Pi
1.The first thing we need to do before installing InfluxDB on the Raspberry Pi is to ensure that all currently installed packages are up to date.
We can update all installed packages by running the following two commands.
sudo apt-updatesudo apt-update
2.With everything updated, we can now move on to installing InfluxDB on the Raspberry Pi.
Our next step is to add the InfluxDB repository key to our Raspberry Pi.
Adding the key allows the package manager in Raspbian to browse the repository and check for installed packages.
We can add the InfluxDB key by running the following command.
curl https://repos.influxdata.com/influxdb.key | gpg --dearmor | sudo tee /usr/share/keyrings/influxdb-archive-keyring.gpg >/dev/null
This command downloads the key with curl and passes it directly to "gpg"Programming with a Pipe"|🇧🇷 Once the keyfob has been disarmed, it will appear in the "/usr/share/keychains/
"Directory.
3.Now that we have installed the InfluxDB repository key on our Raspberry Pi, we need to go ahead and add your repository to the sources list.
Now enter the following command to add the InfluxDB repository to the source list. Make sure you choose the correct command for the version of Raspbian you are running.
Most users performing fresh installs of Raspbian will likely do so.executar Raspbian Buster.
Raspbian/Raspberry Pi operating system
echo "deb [firmado por=/usr/share/keyrings/influxdb-archive-keyring.gpg] https://repos.influxdata.com/debian $(lsb_release -cs) estable" | sudo tee /etc/apt/sources.list.d/influxdb.list
Ubuntu (or Ubuntu Mate)
echo "deb [firmado por=/usr/share/keyrings/influxdb-archive.keyring.gpg] https://repos.influxdata.com/ubuntu $(lsb_release -cs) estable" | sudo tee /etc/apt/sources.list.d/influxdb.list
4.With the repository added, we now need to update the package list again.
We need to do this so that the apt package manager looks for packages in the repository we just added. The operating system does not do this automatically.
Run the following command on your Raspberry Pi to update the package list.
update sudo apt
5.Now that we have the repository set up, we can proceed with installing the InfluxDB software.
To install InfluxDB on our Raspberry Pi, just run the following command.
sudo apt install influxdb
6.Now that InfluxDB is installed on our Raspberry Pi, let's get started at boot time.
We can do this by using the systemctl service manager to enable our InfluxDB service file.
Run the following two commands to allow InfluxDB to start at boot time on your Raspberry Pi.
sudo systemctl unmask influxdbsudo systemctl enable influxdb
The first command we use unmasks the influxdb service file. Unmasking the service ensures that we can enable and start the service, as a masked service cannot start.
Our second command enables the influxdb service. This command tells the service manager to watch "influxdb.service” and configure the service based on its content.
7.With everything set up, we can now start InfluxDB on our Raspberry Pi.
To start the InfluxDB server, we must run the following command. The service manager starts the service and starts monitoring.
sudo systemctl start influxdb
Using InfluxDB on your Raspberry Pi
1.Now that we have InfluxDB installed, we can talk to the database.
To do this, we need to launch the Influx command line tool by running the following command.
You don't have to worry about specifying an address to connect to, as the tool will automatically detect your local InfluxDB installation.
By default, InfluxDB has no user settings. In our next section, we'll explore how to create an admin user to block access to your InfluxDB. For now though, we'll quickly explore InfluxDB.
affluence
2.InfluxDB doesn't come with any default database, so our first task is to create one.
Creating a database is easy in InfluxDB and can be done with "CREATE DATABASE <DBNAME>
“.
For our example, we will create a database called "pimylifeuptemperatur
“.
CREATE DATABASE pimylifeuptemperature
3.Before we can start modifying our new database, we need to tell the CLI: "to use
"es.
Using a database is as simple as running the following command.
USA pimylifeuptemperature
4.Our next step is to write some data to our newly created InfluxDB database.
To do this, we must first gain a basic understanding of the InfluxDB datastore.
Data in InfluxDB is sorted by "time sequences🇧🇷 These "time series" can contain any number or few data points. Each of these data points represents a single sample of that metric.
A data point consists of thetempo, oneMeasurementNames like "Temperature" and at least oneto set up🇧🇷 you can also usekey wordsIt is indexed data consisting only of a string of characters. Tags are essential for optimizing database queries.
If you are familiar with the general layout of an SQL table, you cantempo” as a primary index,Measurementsuch as the table name and thekey wordsyFelderlike column names.
You do not need to specify the timestamp unless you want to specify a specific date and time for the data point.
Below we include the basic format of an InfluxDB data point.
<measure>[,<tag key>=<tag value>...] <field key>=<field value>[,<field key2>=<field value2>...] [unix -nano timestamp]
If you want to learn more about InfluxDB line syntax, see theInfluxDB official documentation.
5.Now that we have a basic understanding of the data in InfluxDB, we can move on to adding our first data point to our database.
For this example database, we will measure the "At temperature"from differentLocationsaround a house
Therefore, we add data points with the measurement name "At temperature' and a tag key of 'era", and a field key of "Wert“.
For our first sampling point, we say that the location of the "living room", and the value is "20” .
INSERT temperature, location = room value = 20
6.To make the data more interesting, to "pick" the data in InfluxDB, let's go ahead and add more random data.
Enter the following commands to insert some additional data into our database. These are just variations of what was said above."INSERTION“command, but with adjusted value and location.
INSERT temperature, location = room value = 10 INSERT temperature, location = room value = 34 INSERT temperature, location = room value = 23
7.Now that we have some sample data, we'll show you how to use that data with "CHOOSE“.
First, you can get all the data for a measurement using a command like the following. This command fetches all fields and keys for the specified measure.
SELECT * OFF Temperature
Using this command with our sample data should give output like the following.
name: temperature time location value -------- ----- 1574055049844513350 room 201574055196564029842 room 101574055196576516557 room 341574055197188117724 room 23
8.Let's say you just want to get the room temperature right now. You can do this by typing the "OS”statement next to a”CHOOSE" Expression.
We also specify the name of the tags/fields we want to get the values from.
When querying tag fields, remember that all tags are treated as strings. This means that we must enclose the value we are looking for in single quotes.
SELECT value FROM temperature WHERE location = 'Schlafzimmer'
With this command, you should get the following dataset, which only shows the temperature reading in the room.
What should it be in the case of our sample data34y23.
name: temperature time location value -------- ----- 1574055049844513350 room 201574055196564029842 room 101574055196576516557 room 341574055197188117724 room 23
9.At this point, you should have a basic understanding of InfluxDB and how its data works.
Add Authentication to InfluxDB
1.The next step is to add additional authentication to our installation of InfluxDB on the Raspberry Pi. Without authentication, anyone can interact with your database.
To get started, we first need to create a user to act as our admin.
To create this user, we first need to load the InfluxDB CLI tool by running the following command.
affluence
2.Within this interface we can create a user who has full access to the database. This user acts as our admin account.
To create this admin user, run the following command in the InfluxDB CLI tool.
be sure to replace<password>with a secure password of your choice.
CREATE admin USER WITH PASSWORD '<password>' WITH ALL PRIVILEGES
This command creates a new user called "Administrator' with your chosen password and grant all privileges.
3.After that you can exit InfluxDB by typing "salidaand pressureLOG IN.
4.Our next task is to modify the InfluxDB configuration file to enable authentication.
We can start editing the file using the following command.
sudo nano /etc/influxdb/influxdb.conf
5.Use inside this fileTO CONTROL+Cto find them[HTTP]Section and add the following options in this section.
Meet
[HTTP]
add below
auth-enabled=truepprof-enabled=truepprof-auth-enabled=trueping-auth-enabled=true
6.After adding the file, save it by pressingTO CONTROL+x, laterY, followed byLOG IN.
7.Now that we've made changes to the InfluxDB configuration, we need to go ahead and restart the service with the following command.
Restarting the service will ensure our configuration changes are read.
sudo systemctl restart influxdb
8.Now that we've enabled InfluxDB authentication, we need to enter our username and password before we can use the InfluxDB CLI tool.
You can use the..."authentication” in the tool or enter the username and password in the command line as below.
Type -admin username -password<password>
Hopefully at this point you have successfully configured InfluxDB on your Raspberry Pi. You should now have a basic understanding of InfluxDB and enable authentication mode.
You can easily see how using this database model facilitates data storage.of sensorsand other very useful sources.
If you had problems getting a Raspberry Pi InfluxDB to work, you can leave a comment below.
recommended
How to install and configure NGINX on Ubuntu
Installing the latest PHP versions on Raspberry Pi OS
How to Use Last Command in Linux
Configuring Ubuntu 20.04 to use a static IP address
Configure Grafana on the Raspberry Pi
How to update Raspbian easily
FAQs
How to setup InfluxDB on Raspberry Pi? ›
- Step 1: Update Raspberry Pi Source list. ...
- Step 2: Add InfluxDB GPG Key. ...
- Step 3: Add InfluxDB repository. ...
- Step 4: Update Source List. ...
- Step 5: Install InfluxDB to Raspberry Pi. ...
- Step 6: Use Systemctl commands. ...
- Step 7: Run InfluxDB on Raspberry Pi.
For best results, InfluxDB servers must have a minimum of 1000 IOPS on storage to ensure recovery and availability. We recommend at least 2000 IOPS for rapid recovery of cluster data nodes after downtime.
How to install InfluxDB 2.0 on Raspberry Pi? ›1) Start by connecting the microSD card to your computer. 2) Go to the Raspberry Pi Software page. 3) Select and download the Raspberry Pi Imager (a tool to flash the OS on the microSD card) for your computer's operating system. 4) Click on the downloaded file to install the Raspberry Pi Imager.
Is there any GUI for InfluxDB? ›The built-in web administration GUI is a simple way to interact with InfluxDB. For any significant use, whether writing or querying data, the HTTP API (reading, writing) or the command line interface are better options.
How much RAM does InfluxDB need? ›Regardless of the cluster load, we recommend the following guidelines for the meta nodes: vCPU or CPU: 1-2 cores. RAM: 512 MB - 1 GB. IOPS: 50.
How do I install and configure InfluxDB? ›- Download and install InfluxDB v2. Download InfluxDB v2. ...
- (Optional) Verify the authenticity of downloaded binary. ...
- Place the executables in your $PATH. ...
- Install InfluxDB as a service with systemd. ...
- Networking ports. ...
- Start InfluxDB. ...
- Enable shell completion (Optional)
InfluxDB writes to the DEFAULT retention policy if we do not supply an explicit RP when writing a point to the database. We make the DEFAULT RP keep data for two hours, because we want InfluxDB to automatically write the incoming ten-second resolution data to that RP.
Is InfluxDB push or pull? ›InfluxDB is a push-based system. It requires an application to actively push data into InfluxDB. Prometheus is a pull-based system. An application publishes the metrics at a given endpoint, and Prometheus fetches them periodically.
Can I use InfluxDB for free? ›InfluxDB Cloud is the most powerful time series database as a service — free to start, easy to use, fast, serverless, elastic scalability.
Is InfluxDB 1.8 still supported? ›InfluxDB 1.8 will continue to be maintained and receive defect fixes through the end of 2021. But InfluxDB 1.8 (and subsequent maintenance releases) will be the last official release on the 1. x line that will be built and distributed by InfluxData.
Does Grafana include InfluxDB? ›
InfluxDB is an open-source time series database (TSDB) developed by InfluxData. It is optimized for fast, high-availability storage and retrieval of time series data in fields such as operations monitoring, application metrics, IoT sensor data, and real-time analytics. Grafana includes built-in support for InfluxDB.
How do I start InfluxDB locally? ›- Point the process to the correct configuration file by using the -config option: influxd -config /etc/influxdb/influxdb.conf.
- Set the environment variable INFLUXDB_CONFIG_PATH to the path of your configuration file and start the process.
InfluxDB is similar to a SQL database, but different in many ways. InfluxDB is purpose-built for time series data. Relational databases can handle time series data, but are not optimized for common time series workloads.
Is InfluxDB NoSQL? ›InfluxDB is a NoSQL database. In many real-world projects, it typically needs to develop data collect applications to collect and send data to the process engine, and then the process engine will process the collected matrix to save in the database.
How to install InfluxDB web UI? ›Accessing the UI
To enable the Admin UI, edit the configuration file to uncomment and set enabled = true in the [admin] section. You must restart the process for any configuration changes to take effect. Once enabled, the Admin UI is available by default at port 8083 , i.e. http://localhost:8083.
InfluxDB Cloud is a fully-managed, elastic time series data platform that allows users to get started quickly and then easily scale to meet their requirements.
What database does InfluxDB use? ›Note: The _internal database is created and used by InfluxDB to store internal runtime metrics.
Is InfluxDB a key value database? ›InfluxDB as a key-value store
As a cutting-edge time series database, InfluxDB borrows some ideas from key-value database designs. Earlier versions of InfluxDB actually provided support for RocksDB as a storage engine.
- Connect to TSDB for InfluxDB by running the following command in the influx CLI. ./influx -ssl -username <Username>-password <Password>-host <Domain name>-port 3242.
- Specify mydb as the database to which you want to write data. > USE mydb Using database mydb.
- Write a single point to the database mydb.
8086. The default port that runs the InfluxDB HTTP service.
How to install and configure InfluxDB in Linux? ›
- 1) Make a file system - optional.
- 2) If not already installed, install wget.
- 3) Fetch the Influxdb software, install it and start it.
- 5) Fetch the Grafana software, install it and start it.
- 8) Added nimon to other servers.
- A) Creating a Grafana Data Source to the InfluxDB.
“InfluxDB is a high-speed read and write database. So think of it. The data is being written in real time, you can read in real time, and when you're reading it, you can apply your machine learning model.
What companies use InfluxDB? ›InfluxData is the creator of InfluxDB, the leading time series platform. We empower developers and organizations, such as Cisco, IBM, Siemens and Tesla, to build real-time IoT, analytics and cloud applications with time-stamped data.
Is an InfluxDB bucket the same as a database? ›A bucket is a named location where data is stored that has a retention policy. It's similar to an InfluxDB v1. x “database,” but is a combination of both a database and a retention policy. When using multiple retention policies, each retention policy is treated as is its own bucket.
Why use InfluxDB instead of MySQL? ›"Time-series data analysis" is the primary reason why developers consider InfluxDB over the competitors, whereas "Sql" was stated as the key factor in picking MySQL. InfluxDB and MySQL are both open source tools.
How good is InfluxDB? ›Best in class Database for storing time based data
InfluxDb is ideal for storing metrics, performance data. for the open source version, a developer needs to implement its own data security model on top of it. community support isn't great enough for influxDb.
InfluxDB is an open-source time series database (TSDB) developed by the company InfluxData. It is written in the Go programming language for storage and retrieval of time series data in fields such as operations monitoring, application metrics, Internet of Things sensor data, and real-time analytics.
Which database is best for time series data? ›- InfluxDB.
- Prometheus.
- Aerospike.
- DataStax.
- QuestDB.
- Druid.
- Amazon Timestream.
- Trendalyze.
InfluxDB Cloud enforces TLS encryption for data in transit from all clients, including Telegraf agents, browsers, and custom applications. Requests using TLS 1.1 or earlier are rejected. By default, data at rest is encrypted using strong encrypted methods (AES-256) within AWS, GCP, and Microsoft Azure.
How popular is InfluxDB? ›InfluxDB is an open-source database. This is, by far, the most popular and most used time-series database in the world.
How do I run InfluxDB on Linux? ›
- Point the process to the correct configuration file by using the -config option: influxd -config /etc/influxdb/influxdb.conf.
- Set the environment variable INFLUXDB_CONFIG_PATH to the path of your configuration file and start the process.
- Limitations on dashboard organization and design. Visualization panels are limited to those made available by Grafana Labs and its community. ...
- No data collection and storage. ...
- Limited data type visualizations.
Cyclotron has an advantage over Grafana because it offers a wider range of widgets, such as data visualization, text and markdown editing, table calculation, and more. It's easy to embed your dashboard on a website or export it as a PDF or image.
Which database is best for Grafana? ›Time series databases
Time series data is the best type of data for monitoring and visualizing in Grafana. One of the most popular databases for storing time-series data. InfluxDB is a part of the TICK-stack: the collection of tools for collecting, storing, and analyzing time-series data.
- Download the influx CLI package. influx CLI v2.6.1 (Windows)
- Expand the downloaded archive. Expand the downloaded archive into C:\Program Files\InfluxData\ and rename it if desired. ...
- Grant network access to the influx CLI.
To perform a query send a GET request to the /query endpoint, set the URL parameter db as the target database, and set the URL parameter q as your query. You may also use a POST request by sending the same parameters either as URL parameters or as part of the body with application/x-www-form-urlencoded .
How does Python write data in InfluxDB? ›Write data to InfluxDB with Python
In your Python program, import the InfluxDB client library and use it to write data to InfluxDB. Define a few variables with the name of your bucket, organization, and token. Instantiate the client. The InfluxDBClient object takes three named parameters: url , org , and token .
InfluxDB is not relational DB = no primary/foreign keys, no joins of measurements, etc. In theory you can use tags as a work around, but they are designated for data with low cardinality = if you have many records with unique ID tag, then you will need a lot of memory.
Does InfluxDB support JSON? ›There are multiple ways to use Flux to bring in data from a variety of different sources including SQL databases, other InfluxDB Cloud Accounts, Annotated CSV from a URL, and JSON. However, previously you could only manually construct tables from a JSON object with Flux as described in this first example.
Is InfluxDB in memory database? ›
InfluxDB is a dedicated time series database that borrows many design concepts from in-memory databases to improve write and query performance for time series data specifically.
How is data stored in InfluxDB? ›InfluxDB stores data in shard groups. Shard groups are organized by retention policy (RP) and store data with timestamps that fall within a specific time interval called the shard duration. The shard group duration is also configurable per RP. To configure the shard group duration, see Retention Policy Management.
How do I install Grafana and InfluxDB? ›- Start InfluxDB.
- Sign up for Grafana Cloud or download and install Grafana.
- In the left navigation of the Grafana UI, hover over the gear icon to expand the Configuration section. ...
- Click Add data source.
- Select InfluxDB from the list of available data sources.
- a – Launch the InfluxDB CLI. ...
- b – Verify that you have admin rights on the InfluxDB server. ...
- c – Create your InfluxDB database. ...
- a – Using cURL. ...
- b – Using Postman. ...
- a – Creating a database in Java.
...
Explore the following ways to work with your data:
- Collect and write data.
- Query data.
- Process data.
- Visualize data.
- Monitor and alert.
- Connect to TSDB for InfluxDB by running the following command in the influx CLI. ./influx -ssl -username <Username>-password <Password>-host <Domain name>-port 3242.
- Specify mydb as the database to which you want to write data. > USE mydb Using database mydb.
- Write a single point to the database mydb.
A fresh install of InfluxDB has no databases (apart from the system _internal ), so creating one is our first task. You can create a database with the CREATE DATABASE <db-name> InfluxQL statement, where <db-name> is the name of the database you wish to create.
Why should I use InfluxDB? ›InfluxDB is purpose-built for time series data. Relational databases can handle time series data, but are not optimized for common time series workloads. InfluxDB is designed to store large volumes of time series data and quickly perform real-time analysis on that data.
Which is better Prometheus or InfluxDB? ›The main advantage of Prometheus is its huge community support, which is based on its CNCF graduated project status. Many applications, especially cloud native ones, already offer Prometheus support out of the box. While InfluxDB also features many integrations, it is not as 'well-connected' as Prometheus.
How to run InfluxDB on Linux? ›- Point the process to the correct configuration file by using the -config option: influxd -config /etc/influxdb/influxdb.conf.
- Set the environment variable INFLUXDB_CONFIG_PATH to the path of your configuration file and start the process.
What protocol does InfluxDB use? ›
InfluxDB uses line protocol to write data points. It is a text-based format that provides the measurement, tag set, field set, and timestamp of a data point. Lines separated by the newline character \n represent a single point in InfluxDB. Line protocol is whitespace sensitive.
Where is data stored in InfluxDB? ›InfluxDB stores data in shard groups. Shard groups are organized by retention policy (RP) and store data with timestamps that fall within a specific time interval called the shard duration. The shard group duration is also configurable per RP.