【问题标题】:Configure 'https' protocol for InfluxDB in Windows machine在 Windows 机器中为 InfluxDB 配置“https”协议
【发布时间】:2019-09-27 06:58:42
【问题描述】:
我需要为 InfluxDB 使用“https”协议。我浏览了他们页面上的 InfluxDB 文章,但它们仅针对 Linux 进行了描述或解释。
例如https://localhost:8086/query?q=show%20databases 而不是 http。
我现在尝试的,请看下面来自influxdb.config的配置sn-p,
# Determines whether HTTPS is enabled.
https-enabled = true
# The SSL certificate to use when HTTPS is enabled.
https-certificate = "/etc/ssl/privatekey.pem"
# Use a separate private key location.
https-private-key = "/etc/ssl/private1.key"
但它不起作用,即使我将启用 https 的属性设置为 true,但 http 仍然有效。
请指导我,感谢您的帮助。
【问题讨论】:
标签:
windows
https
influxdb
【解决方案1】:
我刚刚完成了一个成功的测试,在尝试自己寻找答案时偶然发现了这篇文章。使用this guide 作为参考,我能够通过以下步骤在本地计算机上成功建立HTTPS 连接。
- 我通过运行命令
New-SelfSignedCertificate –DnsName localhost -CertStoreLocation “cert:\LocalMachine\My” 在我的机器上使用powershell 生成了一个自签名证书。这会在证书管理器的“我的证书”中生成一个自签名证书:
我在证书管理器中找到了我创建的证书,并将它从Personal\Certificates复制到Personal\Trusted Root Certification Authorities\Certificates
我使用 OpenSSL 命令行界面和命令 pkcs12 -in "mycertlocation.pfx" -out mycert.pen -nodes 将证书转换为 .pem 文件(证书和私钥包含在一个文件中,并输入了密码。
- 我编辑了我的
influxdb.conf,启用了以下设置:
[http]
enabled = true
bind-address = ":12742"
https-enabled = true
https-certificate = "F:\\InfluxDB\\mycert.pem"
https-private-key = "F:\\InfluxDB\\mycert.pem"
我使用 .\influxd.exe -config .\influxdb.conf 使用新配置重新启动了服务
我使用.\influx.exe -ssl -host localhost -port 12742测试了HTTPS连接,并能够成功连接: