linux 在influxdb docker镜像上启用https:XDB_HTTP_HTTPS_ENABLED=true似乎被忽略

liwlm1x9  于 2023-10-16  发布在  Linux
关注(0)|答案(1)|浏览(119)

我正在使用以下docker compose文件进行influxdb设置:

version: '3'

services:
  influxdb:
    image: influxdb:latest
    container_name: influxdb2.0
    ports:
      - "8083:8083"
      - "8086:8086"
    volumes:
      - ./influxdb/data:/var/lib/influxdb2:rw
      - /etc/letsencrypt/live/MY.DOMAIN/fullchain.pem:/etc/ssl/fullchain.pem
      - /etc/letsencrypt/live/MY.DOMAIN/privkey.pem:/etc/ssl/privkey.pem 
    environment:
      - INFLUXDB_HTTP_HTTPS_ENABLED=true 
      - INFLUXDB_HTTP_HTTPS_CERTIFICATE=/etc/ssl/fullchain.pem
      - INFLUXDB_HTTP_HTTPS_PRIVATE_KEY=/etc/ssl/privkey.pem
      - INFLUXDB_HTTP_LOG_ENABLED=true

但是,当我连接到influxdb时,https没有启用。我使用的证书与我在nginx网站上使用的证书相同(我的.DOMAIN运行在同一台机器上),其中证书按预期工作。docker logs influxdb2.0 | grep http给我看看那些线条

2023-09-28T10:19:06.570793587Z  info    found existing boltdb file, skipping setup wrapper      {"system": "docker", "bolt_path": "/var/lib/influxdb2/influxd.bolt"}
2023-09-28T10:19:06.607712579Z  info    found existing boltdb file, skipping setup wrapper      {"system": "docker", "bolt_path": "/var/lib/influxdb2/influxd.bolt"}
ts=2023-09-28T10:19:06.726261Z lvl=info msg=Listening log_id=0kYpd4MW000 service=tcp-listener transport=http addr=:8086 port=8086

在这种情况下,transport=http应该是transport=https吗?我在influxdb日志中没有发现任何关于http的信息/错误/等。我应该为我的influxdb容器创建一个单独的证书吗?

x3naxklr

x3naxklr1#

我认为你只是使用了一个无效的配置。查看current documentation,看起来您需要设置tls-certtls-key选项。
使用此配置:

volumes:
  influxdb_data:

services:
  influxdb:
    image: docker.io/influxdb:latest
    ports:
      - "8083:8083"
      - "8086:8086"
    volumes:
      - influxdb_data:/var/lib/influxdb2:rw
      - ./certs/fullchain.pem:/etc/ssl/fullchain.pem
      - ./certs/privkey.pem:/etc/ssl/privkey.pem
    environment:
      - INFLUXD_TLS_CERT=/etc/ssl/fullchain.pem
      - INFLUXD_TLS_KEY=/etc/ssl/privkey.pem

当我docker compose up堆栈时,我看到以下输出:

.
.
.
container-influxdb-1  | ts=2023-09-28T11:54:52.248973Z lvl=info msg=Starting log_id=0kYv6kh0000 service=telemetry interval=8h
container-influxdb-1  | ts=2023-09-28T11:54:52.250707Z lvl=info msg=Listening log_id=0kYv6kh0000 service=tcp-listener transport=https addr=:8086 port=8086

我可以通过运行curl -k https://localhost:8086来确认influxdb正在使用TLS:

$ curl -k https://localhost:8086
<!doctype html><html lang="en">
...

相关问题