Database · 4 min read · Sep 29, 2025
Come installare InfluxDB su CentOS 8

InfluxDB è un database open-source e di serie temporali sviluppato da InfluxData. È scritto in Go ed è progettato per gestire carichi elevati di scrittura e query. È noto per la sua semplicità e capacità di operare su larga scala. Può essere eseguito su più sistemi operativi e supporta anche un’ampia gamma di librerie client.
Questo tutorial spiegherà come installare il database di serie temporali InfluxDB su CentOS 8.
Prerequisiti
- Un server che esegue CentOS 8.
- Una password di root configurata sul tuo server.
Installare InfluxDB
Per impostazione predefinita, InfluxDB non è disponibile nel repository predefinito di CentOS 8. Quindi dovrai creare un repo per InfluxDB. Puoi crearlo con il seguente comando:
nano /etc/yum.repos.d/influxdb.repoAggiungi le seguenti righe:
[influxdb]
name = InfluxDB Repository
baseurl = https://repos.influxdata.com/rhel/8/x86_64/stable/
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key
Salva e chiudi il file, quindi aggiorna la cache del repo con il seguente comando:
dnf makecacheSuccessivamente, installa InfluxDB utilizzando il seguente comando:
dnf -y install influxdbUna volta completata l’installazione, verifica la versione installata di InfluxDB con il seguente comando:
rpm -qi influxdbDovresti ottenere il seguente output:
Name : influxdb
Version : 1.8.4
Release : 1
Architecture: x86_64
Install Date: Wednesday 07 April 2021 01:24:54 AM EDT
Group : default
Size : 174431824
License : Proprietary
Signature : RSA/SHA256, Monday 01 February 2021 08:01:46 PM EST, Key ID 684a14cf2582e0c5
Source RPM : influxdb-1.8.4-1.src.rpm
Build Date : Thursday 28 January 2021 05:31:21 AM EST
Build Host : bf85fc4b5de4
Relocations : /
Packager : [email protected]
Vendor : InfluxData
URL : https://influxdata.com
Summary : Distributed time-series database.
Description :
Distributed time-series database.
Gestire il servizio InfluxDB
Puoi avviare e fermare il servizio InfluxDB utilizzando il seguente comando:
systemctl start influxdb
systemctl stop influxdbPer avviare InfluxDB al riavvio del sistema, esegui il seguente comando:
systemctl enable influxdbPer verificare lo stato di InfluxDB, esegui il seguente comando:
systemctl status influxdbDovresti ottenere il seguente output:
? influxdb.service - InfluxDB è un database open-source, distribuito, di serie temporali
Loaded: loaded (/usr/lib/systemd/system/influxdb.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2021-04-07 01:25:11 EDT; 11s ago
Docs: https://docs.influxdata.com/influxdb/
Main PID: 48978 (influxd)
Tasks: 8 (limit: 12524)
Memory: 7.9M
CGroup: /system.slice/influxdb.service
??48978 /usr/bin/influxd -config /etc/influxdb/influxdb.conf
Apr 07 01:25:11 centos8 influxd[48978]: ts=2021-04-07T05:25:11.426523Z lvl=info msg="Starting precreation service" log_id=0TMhWB~l000 service=>
Apr 07 01:25:11 centos8 influxd[48978]: ts=2021-04-07T05:25:11.426552Z lvl=info msg="Starting snapshot service" log_id=0TMhWB~l000 service=sna>
Apr 07 01:25:11 centos8 influxd[48978]: ts=2021-04-07T05:25:11.426570Z lvl=info msg="Starting continuous query service" log_id=0TMhWB~l000 ser>
Apr 07 01:25:11 centos8 influxd[48978]: ts=2021-04-07T05:25:11.426616Z lvl=info msg="Starting HTTP service" log_id=0TMhWB~l000 service=httpd a>
Apr 07 01:25:11 centos8 influxd[48978]: ts=2021-04-07T05:25:11.426634Z lvl=info msg="opened HTTP access log" log_id=0TMhWB~l000 service=httpd >
Apr 07 01:25:11 centos8 influxd[48978]: ts=2021-04-07T05:25:11.426802Z lvl=info msg="Listening on HTTP" log_id=0TMhWB~l000 service=httpd addr=>
Apr 07 01:25:11 centos8 influxd[48978]: ts=2021-04-07T05:25:11.426831Z lvl=info msg="Starting retention policy enforcement service" log_id=0TM>
Apr 07 01:25:11 centos8 influxd[48978]: ts=2021-04-07T05:25:11.427033Z lvl=info msg="Listening for signals" log_id=0TMhWB~l000
Apr 07 01:25:11 centos8 influxd[48978]: ts=2021-04-07T05:25:11.427330Z lvl=info msg="Storing statistics" log_id=0TMhWB~l000 service=monitor db>
Apr 07 01:25:11 centos8 influxd[48978]: ts=2021-04-07T05:25:11.427779Z lvl=info msg="Sending usage statistics to usage.influxdata.com" log_id=>
Per impostazione predefinita, InfluxDB ascolta sulla porta 8086. Puoi controllarlo con il seguente comando:
ss -tunelp | grep 8086Dovresti vedere il seguente output:
tcp LISTEN 0 128 *:8086 *:* users:(("influxd",pid=49040,fd=14)) uid:987 ino:824427 sk:c v6only:0 <->
Abilitare l’autenticazione
Per impostazione predefinita, InfluxDB è configurato per connettersi senza autenticazione. Quindi è consigliabile proteggere InfluxDB con un nome utente e una password.
Per farlo, dovrai abilitare l’autenticazione nel file influxdb.conf.
nano /etc/influxdb/influxdb.confCambia la seguente riga nella sezione [http]:
auth-enabled = true
Salva e chiudi il file, quindi riavvia InfluxDB per applicare le modifiche:
systemctl restart influxdbSuccessivamente, dovrai creare un utente admin per autenticare InfluxDB. Puoi crearlo con il seguente comando:
curl -XPOST "http://localhost:8086/query" --data-urlencode "q=CREATE USER admin WITH PASSWORD 'password' WITH ALL PRIVILEGES"A questo punto, InfluxDB è protetto con un nome utente e una password.
Lavorare con InfluxDB
Ora puoi connetterti alla shell di InfluxDB con il seguente comando:
influx -username 'admin' -password 'password'Una volta connesso, dovresti ottenere il seguente output:
Connected to http://localhost:8086 version 1.8.4
InfluxDB shell version: 1.8.4
Ora, crea un nuovo database utilizzando il seguente comando:
> CREATE DATABASE mydbPer visualizzare tutti i database, esegui il seguente comando:
> SHOW DATABASESDovresti ottenere il seguente output:
name: databases
name
----
_internal
mydb
Ora, esci dalla shell di InfluxDB con il seguente comando:
> exitPuoi anche elencare tutti i database senza accedere a InfluxDB come mostrato di seguito:
curl -G http://localhost:8086/query -u admin:password --data-urlencode "q=SHOW DATABASES"Dovresti ottenere il seguente output:
{"results":[{"statement_id":0,"series":[{"name":"databases","columns":["name"],"values":[["_internal"],["mydb"]]}]}]}
Conclusione
Congratulazioni! Hai installato con successo InfluxDB su CentOS 8. Ora puoi utilizzare InfluxDB per gestire una grande quantità di dati in un ambiente di produzione.
Ricevi i nuovi post nella tua casella di posta.
Nessuno spam. Disiscriviti in qualsiasi momento.