On this article we will discuss how to install InfluxDB Open Source (OSS) edition on Ubuntu 20.04 LTS. For this tutorial we are going to use the InfluxDB stable version 1.8.0 Open source edition which is running on single node.
Introduction
InfluxDB is a time series database (TSDB) which is designed to handle high write and query loads, InfluxDB is developed by InfluxData and written in Go. InfluxDB is meant to be used as a backing store for any use case involving large amounts of timestamped data, including DevOps monitoring, application metrics, Internet of Things sensor data, and real-time analytics.
The initial release of InfluxDB was introduced on 24 September 2013, and the last stable release version is 1.8.0 which was released on 13 April 2020. When the article is written the Preview release for 2.0.0-beta.16 also was released on 7 August 2020.
The key features of InfluxDB 1.8.0 (as mentioned on the InfluxDB official website) are :
- Custom high performance datastore written specifically for time series data. The TSM engine allows for high ingest speed and data compression
- Written entirely in Go.
- It compiles into a single binary with no external dependencies.
- Simple, high performing write and query HTTP APIs.
- Plugins support for other data ingestion protocols such as Graphite, collectd, and OpenTSDB.
- Expressive SQL-like query language tailored to easily query aggregated data.
- Tags allow series to be indexed for fast and efficient queries.
- Retention policies efficiently auto-expire stale data.
- Continuous queries automatically compute aggregate data to make frequent queries more efficient.
InfluxDB Installation Steps
Prerequisite
Installation of the InfluxDB package on Ubuntu Linux operating system require root or an ordinary account with sudo privileges, Good internet connection, and sufficient disk space.
InfluxDB Installation Step
1. Add InfluxDB repository
We have to add the InfluxDB repository to our system. For this purpose, just hit, the command line below:
ramans@otodiginet:~$ wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add - ramans@otodiginet:~$ source /etc/lsb-release ramans@otodiginet:~$ echo "deb https://repos.influxdata.com/${DISTRIB\_ID,,} ${DISTRIB\_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
2. Install InfluxDB
After InfluxDB repository was added to the system with no error, then we will continue to update the system and the install and start the InfluxDB. Please find the command lines below for this step.
ramans@otodiginet:~$ sudo apt-get update ramans@otodiginet:~$ sudo apt-get install influxdb ramans@otodiginet:~$ sudo service influxdb start
The output will be as follow :
Reading package lists… Done Building dependency tree Reading state information… Done The following NEW packages will be installed: influxdb 0 upgraded, 1 newly installed, 0 to remove and 230 not upgraded. Need to get 0 B/63.5 MB of archives. After this operation, 172 MB of additional disk space will be used. Selecting previously unselected package influxdb. (Reading database … 224856 files and directories currently installed.) Preparing to unpack …/influxdb\_1.8.2-1\_amd64.deb … Unpacking influxdb (1.8.2-1) … Setting up influxdb (1.8.2-1) … Created symlink /etc/systemd/system/influxd.service → /lib/systemd/system/influxdb.service. Created symlink /etc/systemd/system/multi-user.target.wants/influxdb.service → /lib/systemd/system/influxdb.service. Processing triggers for man-db (2.9.1-1)
3. Verify the authenticity of downloaded binary (optional)
Due to the security reasons, by using gpg command line, we will verify the signature of our InfluxDB. Here are several steps for verifying the installation.
Download and import InfluxData’s public key:
curl -sL https://repos.influxdata.com/influxdb.key | gpg --import Download the signature file for the release by adding .asc to the download URL. For example: wget https://dl.influxdata.com/influxdb/releases/influxdb-1.8.0_linux_amd64.tar.gz.asc Verify the signature with gpg –verify: gpg --verify influxdb-1.8.0_linux_amd64.tar.gz.asc influxdb-1.8.0_linux_a
Checking InfluxDB service, by submitting command line :
ramans@otodiginet:~$ sudo systemctl status influxdb
output will be :
ramans@otodiginet:~$ sudo systemctl status influxdb ● influxdb.service - InfluxDB is an open-source, distributed, time series database Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2020-09-16 21:13:33 PDT; 7s ago Docs: https://docs.influxdata.com/influxdb/ Main PID: 7178 (influxd) Tasks: 13 (limit: 4624) Memory: 9.7M CGroup: /system.slice/influxdb.service └─7178 /usr/bin/influxd -config /etc/influxdb/influxdb.conf Sep 16 21:13:34 bckinfo influxd\[7178\]: ts=2020-09-17T04:13:34.000518Z lvl=info msg="Starti> Sep 16 21:13:34 bckinfo influxd\[7178\]: ts=2020-09-17T04:13:34.000537Z lvl=info msg="Starti> Sep 16 21:13:34 bckinfo influxd\[7178\]: ts=2020-09-17T04:13:34.000559Z lvl=info msg="Starti> Sep 16 21:13:34 bckinfo influxd\[7178\]: ts=2020-09-17T04:13:34.000572Z lvl=info msg="opened> Sep 16 21:13:34 bckinfo influxd\[7178\]: ts=2020-09-17T04:13:34.000583Z lvl=info msg="Auth i> Sep 16 21:13:34 bckinfo influxd\[7178\]: ts=2020-09-17T04:13:34.001203Z lvl=info msg="Listen> Sep 16 21:13:34 bckinfo influxd\[7178\]: ts=2020-09-17T04:13:34.001446Z lvl=info msg="Storin> Sep 16 21:13:34 bckinfo influxd\[7178\]: ts=2020-09-17T04:13:34.001526Z lvl=info msg="Starti> Sep 16 21:13:34 bckinfo influxd\[7178\]: ts=2020-09-17T04:13:34.002607Z lvl=info msg="Sendin> Sep 16 21:13:34 bckinfo influxd\[7178\]: ts=2020-09-17T04:13:34.004527Z lvl=info msg="Listen>
4. Configuring InfluxDB
The local configuration file of InfluxDB is located on /etc/influxdb/influxdb.conf file, we could modify this file if we want to change. We will use this file to launch the InfluxDB on our system. Use the command line below to point the configuration file.
ramans@otodiginet:~$ influxd -config /etc/influxdb/influxdb.conf
5. Open InfluxDB service ports on the firewall
By default, InfluxDB uses the following network ports: TCP port 8086 is used for client-server communication over InfluxDB’s HTTP API and TCP port 8088 is used for the RPC service for backup and restore.
We will enable this ports for external connection to InfluxDB, we will submit command line below :
ramans@otodiginet:~$ sudo ufw enable Firewall is active and enabled on system startup ramans@otodiginet:~$ sudo ufw allow 8086/tcp Rule added Rule added (v6)
Connect and Create Database on Influxdb
After the installation and configuration of InfluxDB was done, we will try to connect to InfluxDB and creating a new user and database.
User name : bckinfo
Password : stongpassword and
Database name : bckinfo_DB
The command line is as follow :
ramans@otodiginet:~$ curl -XPOST "http://localhost:8086/query" \\ --data-urlencode "q=CREATE USER otodiginet WITH PASSWORD 'strongpassword' WITH ALL PRIVILEGES" {"results":\[{"statement\_id":0}\]}
ramans@otodiginet:~$ influx -username 'bckinfo' -password 'strongpassword' Connected to http://localhost:8086 version 1.8.2 InfluxDB shell version: 1.8.2 CREATE DATABASE bckinfo\_DB SHOW DATABASES name: databases name \_internal bckinfo\_DB
Conclusion
So far, we have successfully done install the InfluxDB on Ubuntu 20.04 LTS, and also create user and database on it. As we know InfluxDB is also an integral part of TIG Stack (Telegraf, InfluxDB and Grafana). Drop your comment on comment dialogue box for our improvement.