How to set up InfluxDB 2 on a Raspberry Pi - Raspberry Pi Projects, Tutorials, Learning DIY Electronics - Makergenix

Breaking

 


How to set up InfluxDB 2 on a Raspberry Pi

This article explains how to set up InfluxDB 2 on a Raspberry Pi. A free and open-source time-series database is InfluxDB (TSDB). Therefore, it is desirable to store sensor data that includes timestamps across a specific time frame.

How to set up InfluxDB 2 on a Raspberry Pi

There are several restrictions in the InfluxDB free cloud plan that might not be appropriate for your applications, such as the maximum 30-day data retention. Install InfluxDB on a local computer, such as your Raspberry Pi, if you want complete control over your data.

GPS RTK HAT

Make sure you choose a MicroSD card with enough storage space because the quantity of data you can save will be restricted by Raspberry Pi's storage.

Prerequisites

  • MicroSD Card: Since the Raspberry Pi lacks internal memory, you must install your operating system on a microSD card. On the microSD card, the operating system will be installed.
  • I advise using a class 10 microSD card with at least 16GB of storage.
  • Raspberry Pi 3 or the Raspberry Pi 4
  • 64-bit architecture: Raspberry Pi OS will be installed (64-bit)

Setup the Raspberry Pi OS (64-bit)

Only 64-bit architectures are compatible with InfluxDB 2 today. In order to properly install InfluxDB 2, you must be using the 64-bit versions of the Raspberry Pi OS or any other operating system (such as Ubuntu, for example). Only the Raspberry Pi 3 and 4 are compatible with Raspberry Pi OS (64-bit).

Installing Raspberry Pi OS requires the following actions (64-bit).

  1. Begin by connecting your computer and microSD card.
  2. Visit the website for Raspberry Pi software.
  3. Decide the operating system for your machine to use and download the Raspberry Pi Imager (a tool to flash the OS on the microSD card).
  4. To set up the Raspberry Pi Imager, click the downloaded file.
  5. The Raspberry Pi Imager will launch when the installation is finished.
  6. To choose the operating system, click Choose OS. After choosing Raspberry Pi OS, choose Raspberry Pi OS (other) (64-bit).
  7. Opt for storage. The microSD card you wish to install the OS on must be selected.
  8. You may access advanced options in the Raspberry Pi Imager to set up hostname, SSH, and Wi-Fi, among other things. Click the gear icon to enter advanced settings. If the gear symbol isn't visible in your window, use Ctrl-Shift-X to bring up the advanced settings window.
  9. You may configure the hostname (which is raspberrypi by default), activate SSH, and specify a password for the SSH connection.
  10. Additionally, configure Wi-Fi using your local network login information so that you may subsequently access your Raspberry Pi over Wi-Fi.
  11. Establish your time zone and country. Lastly, select Save.
  12. Click on write to begin installing the operating system on the microSD card after selecting the operating system, storage, and advanced options.
  13. Be patient while the operating system is installed.
  14. Click Continue when the installation is finished. The microSD card will be removed securely.
  15. After that, take the card out of your computer and place it in the Raspberry Pi. After that, turn on the Raspberry Pi to get it going.

Installing InfluxDB 2 on Raspberry Pi Board.

To interact with the Raspberry Pi, we'll utilise SSH. An application like PuTTY can be used if you're using Windows. You can utilise the Terminal if you're running Mac OS or Linux.

Check out these steps if you don't know how to connect through SSH to your Raspberry Pi.

Run the following command after your Raspberry Pi and SSH are connected (copy the complete command with CTRL-C and then paste it into the Terminal window with a right-click on the mouse).
wget -qO- https://repos.influxdata.com/influxdb.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/influxdb.gpg > /dev/null
export DISTRIB_ID=$(lsb_release -si); export DISTRIB_CODENAME=$(lsb_release -sc)
echo "deb [signed-by=/etc/apt/trusted.gpg.d/influxdb.gpg] https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list > /dev/null

sudo apt-get update && sudo apt-get install influxdb2
It will eventually request that you install more packages. To accept, type Y and then click Enter. The Terminal window should appear as follows after installation:

install additional packages

To start InfluxDB as a background service at startup, type the following command.
sudo service influxdb start
Run the next command to make sure InfluxDB is functioning as it should.
sudo service influxdb status
You should purchase the following:


This indicates that InfluxDB is functioning effectively as a service.

Please take note that you may also wish to look at the official installation guidelines here.

GPS RTK HAT

Raspberry Pi InfluxDB Access

You may now connect to InfluxDB using the Raspberry Pi's IP address and port 8086. I can just enter the following in my web browser to access InfluxDB because my Raspberry Pi's IP address is 192.168.1.106:
192.168.1.106:8086
You may enter the following command to learn your Raspberry Pi's IP address:
hostname -I
The screen below is what you'll see when you first enter InfluxDB. Simply choose to Get Started.

You must create the first user. Fill in the form's information using any names you choose. The username and password must be kept in mind so that you may access InfluxDB data later.

Click Continue to continue after that.

You may then select Quick Start.

The Getting Started screen will be reached after the redirect.

Conclusion

Congratulations! You have successfully set up a first user, organisation, and bucket in InfluxDB on your Raspberry Pi.

You may now begin loading data into InfluxDB.

GPS RTK HAT

 


Most Viewed Posts

Write For Us

Name

Email *

Message *

All Blogs