设置基于 docker 的 InfluxDB/Grafana 网络时出现问题

mfc*_*css 5 docker influxdb grafana docker-for-windows

我的目的是使用 Windows Docker 部署 InfluxDB 2.0.8 数据库,并通过同一 Docker 网络上的自托管 Grafana 实例链接到它。

\n

为此,我已完成以下步骤:

\n
    \n
  1. 通过以下方式启动网络、InfluxDB 和 Grafana:
  2. \n
\n
docker network create influxdb\ndocker run -d --net=influxdb --name=grafana -p 3000:3000 grafana/grafana\ndocker run -d --net=influxdb --name=influxdb -p 8086:8086 --volume C:/influxdb:/var/lib/influxdb2 influxdb:2.0.8\n
Run Code Online (Sandbox Code Playgroud)\n
    \n
  1. 打开 http://localhost:8086 进行基础设置。通过 InfluxDB UI 获取以下详细信息:
  2. \n
\n
    \n
  • 组织 ID(来自“关于”页面)
  • \n
  • 令牌(来自令牌页面,使用已经生成的令牌)
  • \n
  • 默认存储桶(我创建的存储桶)
  • \n
  • 网址(http://localhost:8086)
  • \n
\n
    \n
  1. 然后,我通过 localhost:3000 转到 Grafana 并添加 InfluxDB 数据存储 (Flux) 并输入上述详细信息。但是,当我测试它时,我收到“读取 InfluxDB 时出错”的消息。在控制台中,我收到以下错误:
  2. \n
\n
POST http://localhost:3000/api/ds/query 400 (Bad Request)\n{refId: \'test\', message: \'Post "http://localhost:8086/api/v2/query?org=35e0f\xe2\x80\xa6l tcp 127.0.0.1:8086: connect: connection refused\'}\n
Run Code Online (Sandbox Code Playgroud)\n

知道上面可能缺少什么吗?

\n

小智 5

我认为从 grafana 访问 influx 的另一种方法是从容器名称访问它:将 influxdb 数据源设置为:influxdb:8086