CentOS Grafana How To's RHEL

How To Install InfluxDB on CentOS 8 / RHEL 8

[vc_row][vc_column][vc_column_text]In this article will guide you on how to install InfluxDB on CentOS 8 / RHEL 8 to start monitoring and visualization of your network Infrastructure.
InfluxDB provides the repository for installing InfluxDB on CentOS 8 or RHEL 8

InfluxDB is an open-source time series database developed written in Go by InfluxData. InfluxDB is optimized for fast, high-availability storage and retrieval of time series data for metrics analysis. This can be installed on a single server or a clustered.

1. Add InfluxDB repository to your system,run the following command with sudo privileged.
[simterm]
$ sudo tee /etc/yum.repos.d/influxdb.repo<<EOF
[influxdb]
name = InfluxDB Repository
baseurl = https://repos.influxdata.com/rhel/7/x86_64/stable/
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key
EOF
[/simterm]

2. Update your cache and confirm that the repository is working fine:
[simterm]
$ sudo dnf makecache
[/simterm]

3. You can now install InfluxDB since we added already on repositories
To install InfluxDB run the following command.
[simterm]
$ sudo dnf -y install influxdb
[/simterm]

Result:
[simterm]
Last metadata expiration check: 0:10:57 ago on Mon 20 Apr 2020 12:50:15 AM PST.
Dependencies resolved.
=============================================================================================================================================================================
Package Architecture Version Repository Size
=============================================================================================================================================================================
Installing:
influxdb x86_64 1.8.0-1 influxdb 60 M

Transaction Summary
=============================================================================================================================================================================
Install 1 Package

Total download size: 60 M
Installed size: 164 M
Downloading Packages:
influxdb-1.8.0.x86_64.rpm 1.9 MB/s | 60 MB 00:31
—————————————————————————————————————————————————————————–
Total 1.9 MB/s | 60 MB 00:31
warning: /var/cache/dnf/influxdb-5468cd5ca80e07dd/packages/influxdb-1.8.0.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 2582e0c5: NOKEY
InfluxDB Repository 3.7 kB/s | 3.0 kB 00:00
Importing GPG key 0x2582E0C5:
Userid : “InfluxDB Packaging Service <[email protected]>”
Fingerprint: 05CE 1508 5FC0 9D18 E99E FB22 684A 14CF 2582 E0C5
From : https://repos.influxdata.com/influxdb.key
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: influxdb-1.8.0-1.x86_64 1/1
Installing : influxdb-1.8.0-1.x86_64 1/1
Running scriptlet: influxdb-1.8.0-1.x86_64 1/1
Created symlink /etc/systemd/system/influxd.service → /usr/lib/systemd/system/influxdb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/influxdb.service → /usr/lib/systemd/system/influxdb.service.

Verifying : influxdb-1.8.0-1.x86_64 1/1

Installed:
influxdb-1.8.0-1.x86_64

Complete!
[/simterm]

4. Checked installed package details by running the command.
[simterm]
$ rpm -qi influxdb

Name : influxdb
Version : 1.8.0
Release : 1
Architecture: x86_64
Install Date: Mon 20 Apr 2020 01:01:48 AM PST
Group : default
Size : 171708035
License : Proprietary
Signature : RSA/SHA256, Sat 18 Apr 2020 09:41:56 AM PST, Key ID 684a14cf2582e0c5
Source RPM : influxdb-1.8.0-1.src.rpm
Build Date : Sun 12 Apr 2020 03:56:55 PM PST
Build Host : 0e5416f9f2d6
Relocations : /
Packager : [email protected]
Vendor : InfluxData
URL : https://influxdata.com
Summary : Distributed time-series database.
Description :
Distributed time-series database.
[/simterm]

5.Start and enable InfluxDB service on CentOS 8 / RHEL 8 by running the command:
[simterm]
$ sudo systemctl enable –now influxdb
[/simterm]

6. Now check InfluxDB status to confirm it is running on the system.
[simterm]
$ 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 Mon 2020-04-20 01:06:03 PST; 1min 45s ago
Docs: https://docs.influxdata.com/influxdb/
Main PID: 7277 (influxd)
Tasks: 18 (limit: 26213)
Memory: 19.2M
CGroup: /system.slice/influxdb.service
└─7277 /usr/bin/influxd -config /etc/influxdb/influxdb.conf

[/simterm]

7. Configure InfluxDB on the system firewall on CentOS 8 / RHEL 8, Allow or open the InfluxDB services on port 3000 via TCP on your server, by adding new firewall rules and 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:
[simterm]
$ sudo firewall-cmd –add-port=8086/tcp –permanent
$ sudo firewall-cmd –reload
[/simterm]

8. 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.
[simterm]
$ sudo systemctl restart influxdb
[/simterm][/vc_column_text][vc_column_text]9. Configure InfluxDB http Authentication
If you need http authentication, modify influxdb http section to contain the following and un comment # auth-enabled
[simterm]
$ sudo vi /etc/influxdb/influxdb.conf
[/simterm]

[simterm]
[http]
# Determines whether user authentication is enabled over HTTP/HTTPS. -pr3p
# auth-enabled = true

[/simterm]
10. Restart InfluxDB services
[simterm]
$ sudo systemctl restart influxdb
[/simterm]

11. Create a user with an authentication password:
[simterm]
curl -XPOST “http://localhost:8086/query” –data-urlencode “q=CREATE USER \
username WITH PASSWORD ‘strongpassword’ WITH ALL PRIVILEGES”
[/simterm]

Note:
– 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.
[simterm]
influx -username ‘username’ -password ‘password’
[/simterm]

For curl, use -u to specify username and password separated by a colon.
[simterm]
curl -G http://localhost:8086/query -u username:password –data-urlencode “q=SHOW DATABASES”
[/simterm]

By default, influxdb service is listening on all interfaces on port 8086.
[simterm]
$ ss -tunelp | grep 8086
tcp LISTEN 0 128 *:8086 *:* users:((“influxd”,pid=2072,fd=5)) uid:985 ino:37787 sk:6 v6only:0 <->
[/simterm]

Congrats you have successfully installed and configured InfluxDB installed on CentOS 8 or RHEL 8[/vc_column_text][/vc_column][/vc_row]

Post Comment