CentOS Stream 9
Sponsored Link

InfluxDB : Enable HTTPS
2022/11/16
 
Enable HTTPS on InfluxDB server.
(used HTTP connection by default)
[1]
Get SSL Certificate, or Create self-signed Certificate.
It uses self signed Certificate on this example.
[2] Enable HTTPS.
[root@dlp ~]#
cp /etc/pki/tls/certs/{server.crt,server.key} /etc/influxdb/

[root@dlp ~]#
chown influxdb:influxdb /etc/influxdb/{server.crt,server.key}

[root@dlp ~]#
vi /etc/influxdb/influxdb.conf
# line 309 : uncomment and change
https-enabled = true

# line 312 : uncomment and change to your sertificate
https-certificate = "/etc/influxdb/server.crt"

# line 315 : uncomment and change to your sertificate
https-private-key = "/etc/influxdb/server.key"

[root@dlp ~]#
systemctl restart influxdb
[3] Connect to InfluxDB from Clients via HTTPS like follows.
# on CLI connection, add [ssl] option
# if using valid certificate, specify the same hostname registered in certificate

[root@dlp ~]#
influx -host dlp.srv.world -ssl

Connected to https://dlp.srv.world:8086 version 1.8.10
InfluxDB shell version: 1.8.10
> exit

# for self signed certificate, add [-unsafeSsl] option

[root@dlp ~]#
influx -ssl -unsafeSsl

Connected to https://localhost:8086 version 1.8.10
InfluxDB shell version: 1.8.10
> exit

# HTTP API

[root@dlp ~]#
curl -G https://dlp.srv.world:8086/query?pretty=true -u admin:adminpassword --data-urlencode "q=show users"

{
    "results": [
        {
            "statement_id": 0,
            "series": [
.....
.....

# HTTP API (self signed)

[root@dlp ~]#
curl -k -G https://localhost:8086/query?pretty=true -u admin:adminpassword --data-urlencode "q=show users"

{
    "results": [
        {
            "statement_id": 0,
            "series": [
.....
.....
Matched Content