InfluxDB : Install2022/11/16 |
Install Time Series Database, InfluxDB.
|
|
[1] | Install InfluxDB from the InfluxDB official repository. |
[root@dlp ~]# cat > /etc/yum.repos.d/influxdb.repo <<'EOF'
[influxdb]
name = InfluxDB Repository - RHEL $releasever
baseurl = https://repos.influxdata.com/rhel/$releasever/$basearch/stable
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdata-archive_compat.key
EOF
[root@dlp ~]#
[root@dlp ~]# dnf -y install influxdb systemctl enable --now influxdb
|
[2] | If Firewalld is running and also you'd like to access to InfluxDB from other hosts, allow service port. |
[root@dlp ~]# firewall-cmd --add-port=8086/tcp success [root@dlp ~]# firewall-cmd --runtime-to-permanent success |
[3] | Configure InfluxDB. By default, authentication is disabled, all users can use InfluxDB with privileges. So enable authentication first. |
# create an admin user # [admin] ⇒ specify any username you like # [adminpassword] ⇒ set any password [root@dlp ~]# influx -execute "create user admin with password 'adminpassword' with all privileges" [root@dlp ~]# influx -execute "show users" user admin ---- ----- admin true
[root@dlp ~]#
vi /etc/influxdb/influxdb.conf [http] .... .... # The bind address used by the HTTP service. # bind-address = ":8086" # Determines whether user authentication is enabled over HTTP/HTTPS. # line 263 : uncomment and change auth-enabled = true[root@dlp ~]# systemctl restart influxdb
|
[4] | After enabling authentication, access InfluxDB CLI like follows. |
# add user info on CLI [root@dlp ~]# influx -username admin -password adminpassword
Connected to http://localhost:8086 version 1.8.10
InfluxDB shell version: 1.8.10
> exit
# set user info on environment variables [root@dlp ~]# export INFLUX_USERNAME=admin [root@dlp ~]# export INFLUX_PASSWORD=adminpassword [root@dlp ~]# influx
Connected to http://localhost:8086 version 1.8.10
InfluxDB shell version: 1.8.10
> exit
# authenticate on HTTP API [root@dlp ~]# curl -G http://localhost:8086/query?pretty=true -u admin:adminpassword --data-urlencode "q=show users" { "results": [ { "statement_id": 0, "series": [ { "columns": [ "user", "admin" ], "values": [ [ "admin", true ] ] } ] } ] } |
Sponsored Link |