How To Install InfluxDB on CentOS 8 / RHEL 8

Posted on 65 views

How can i install InfluxDB on RHEL 8 / CentOS 8?. InfluxDB is an open-source time series database written in Go and optimized for fast, high-availability storage and retrieval of time series data for metrics analysis.

For CentOS 7 / RHEL 7, Ubuntu and Debian distributions, refer:

Install InfluxDB on CentOS 8 | RHEL 8

Influxdata provides the repository for installing InfluxDB on RHEL 8 | CentOS 8. Add InfluxDB repository to your system using the commands below:

cat <

Update cache to confirm that the repository is working fine:

sudo dnf makecache

Then install influxDB:

sudo dnf -y install influxdb

Check installed package details.

$ rpm -qi influxdb 
Name        : influxdb
Version     : 1.8.10
Release     : 1
Architecture: x86_64
Install Date: Wed Apr 20 10:02:40 2022
Group       : default
Size        : 153372325
License     : Proprietary
Signature   : RSA/SHA256, Mon Oct 11 20:31:46 2021, Key ID 684a14cf2582e0c5
Source RPM  : influxdb-1.8.10-1.src.rpm
Build Date  : Mon Oct 11 16:01:06 2021
Build Host  : cfee76502fcd
Relocations : /
Packager    : [email protected]
Vendor      : InfluxData
URL         : https://influxdata.com
Summary     : Distributed time-series database.
Description :
Distributed time-series database.

Start InfluxDB Service on RHEL 8 / CentOS 8

Start and enable InfluxDB service on CentOS 8 / RHEL 8:

sudo systemctl enable --now influxd

Check status to confirm it is running

$ systemctl status influxdb
 ● influxdb.service - InfluxDB is an open-source, distributed, time series database
    Loaded: loaded (/usr/lib/systemd/system/influxdb.service; enabled; vendor preset: disabled)
    Active: active (running) since Wed 2022-04-20 10:11:04 EAT; 23s ago
      Docs: https://docs.influxdata.com/influxdb/
  Main PID: 29345 (influxd)
     Tasks: 8 (limit: 11512)
    Memory: 31.4M
    CGroup: /system.slice/influxdb.service
            └─29345 /usr/bin/influxd -config /etc/influxdb/influxdb.conf
........................................................................

Configure InfluxDB firewall on CentOS 8 | RHEL 8

By default, InfluxDB uses the following network ports:

  • TCP port 8086 is used for client-server communication over InfluxDB’s HTTP API
  • TCP port 8088 is used for the RPC service for backup and restore.

To open it on the firewall, use the command:

sudo firewall-cmd --add-port=8086/tcp --permanent
sudo firewall-cmd --reload

Port mappings can be modified by changing the file /etc/influxdb/influxdb.conf. 

If you make any change in the configuration file, restart influxdb service.

sudo systemctl restart influxdb

Configure InfluxDB http Authentication

If you need http authentication, modify influxdb http section to contain the following.

$ sudo vi /etc/influxdb/influxdb.conf
[http]
auth-enabled = true

Restart InfluxDB service.

sudo systemctl restart influxdb

Then create a user with an authentication password:

curl -XPOST "http://localhost:8086/query" --data-urlencode "q=CREATE USER \
username WITH PASSWORD 'strongpassword' WITH ALL PRIVILEGES"

Replace:

  • username with your own username
  • strongpassword with your own password (note that the password requires single quotes)

Now whenever you need to run any influxdb commands on the terminal, you need to specify username using -username and password using -password options.

influx -username 'username' -password 'password'

For curl, use -u to specify username and password separated by a colon.

curl -G http://localhost:8086/query -u username:password --data-urlencode "q=SHOW DATABASES"

By default, influxdb service is listening on all interfaces on port 8086.

$ sudo ss -tunelp | grep 8086
 tcp   LISTEN  0  128     *:8086 *:* users:(("influxd",pid=2072,fd=5)) uid:985 ino:37787 sk:6 v6only:0 <-> 

You now have InfluxDB installed on RHEL 8. For usage of InfluxDB, check our guide on:

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.