0

在 Grafana 中创建 InfluxQL 数据源到 InfluxDB 2.0 (2.0.0-beta.16) 失败并出现错误:

can't assign to property "executedQueryString" on "<!doctype html><html><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><title>InfluxDB 2.0</title><base href=\"/\"><link rel=\"shortcut icon\" href=\"/favicon.ico\"></head><body><div id=\"react-root\" data-basepath=\"\"></div><script src=\"/5e93c5f5aa.js\"></script></body></html>": not an object

我按照程序在https://docs.influxdata.com/influxdb/v2.0/query-data/influxql/#map-unmapped-buckets上映射未映射的存储桶,并尝试使用https://在 Grafana 中创建数据源docs.influxdata.com/influxdb/v2.0/tools/grafana/#configure-grafana-to-use-influxql

使用邮递员,我在查询 InfluxDB v1 兼容端点时得到相同的输出:

curl --location --request GET 'http://54.226.129.163/query?db=db-35days&rp=rp-35days' \
--header 'Authorization: Token VuLd01YvgyBNnWQlzFXDgDT08DFGdfgr4et6456HzrNpHqKF4q8VvQUZrMLLoyUUpJbdSU0mwUPYISV1LdjQ==' \
--data-urlencode 'q=select * from ping'

<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>InfluxDB 2.0</title>
    <base href="/">
    <link rel="shortcut icon" href="/favicon.ico">
</head>

<body>
    <div id="react-root" data-basepath=""></div>
    <script src="/5e93c5f5aa.js"></script>
</body>

</html>

我验证了数据库保留策略映射是否可用:

curl --location --request GET 'http://my-influxdb/api/v2/dbrps/06868db0219ad000?org=PBC' \
--header 'Authorization: Token VuLd01YvgyBNnWQlzFXDgDT08DFGdfgr4et6456HzrNpHqKF4q8VvQUZrMLLoyUUpJbdSU0mwUPYISV1LdjQ=='


{
    "content": {
        "id": "06868db0219ad000",
        "database": "db-35days",
        "retention_policy": "rp-35days",
        "default": true,
        "organization_id": "218adfcaf421474d",
        "bucket_id": "9fd165c106e5f962"
    }
}

根据https://docs.influxdata.com/influxdb/v2.0/reference/api/influxdb-1x/dbrp/上的文档, 使用 DBRP 映射自动创建一个新的 database/retention-policy 存储桶,并写入数据如果没有找到匹配的桶,则到桶。我也尝试过使用“所有访问令牌”,但得到了同样的错误响应:

curl --location --request POST 'http://my-influxdb/write?db=testdb&rp=testrp' \
--header 'Content-Type: application/json' \
--header 'Authorization: Token VuLd01YvgyBNnWQlzFXDgDT08DFGdfgr4et6456HzrNpHqKF4q8VvQUZrMLLoyUUpJbdSU0mwUPYISV1LdjQ==' \
--data-raw 'measurement,host=host1 field1=2i,field2=2.0 1577836800000000000'


<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>InfluxDB 2.0</title>
    <base href="/">
    <link rel="shortcut icon" href="/favicon.ico">
</head>

<body>
    <div id="react-root" data-basepath=""></div>
    <script src="/5e93c5f5aa.js"></script>
</body>

</html>

我可以使用 Flux 毫无问题地查询 v2 端点:

curl --location --request POST 'http://my-influxdb/api/v2/query?org=PBC' \
--header 'Content-Type: application/vnd.flux' \
--header 'Accept: application/csv' \
--header 'Authorization: Token VuLd01YvgyBNnWQlzFXDgDT08DFGdfgr4et6456HzrNpHqKF4q8VvQUZrMLLoyUUpJbdSU0mwUPYISV1LdjQ==' \
--data-raw 'from(bucket: "35days")
  |> range(start: -12h)
  |> filter(fn: (r) => r["_measurement"] == "ping")
  |> yield(name: "mean")'


,result,table,_start,_stop,_time,_value,_field,_measurement,account
,mean,0,2020-10-27T22:52:58.644679856Z,2020-10-28T10:52:58.644679856Z,2020-10-28T08:49:35Z,0.4,standard_deviation_ms,ping,pbc
4

2 回答 2

0

在 InfluxDB 2.0.2 中仍然是我的问题,我可以在日志中看到它根本没有读取我的查询:

curl --request GET http://localhost:8086/query \
> --header "Authorization: Token <token>" \
> --data-urlencode "db=<db>" \
> --data-urlencode "rp=autogen" \
> --data-urlencode "q=SELECT * FROM <measurment>"

是在映射之后。这是我在日志中可以看到的

ts=2020-12-09T11:26:08.379293Z lvl=info msg="executing new query" log_id=0QwcNMnG000 query=
于 2020-12-09T11:32:58.907 回答
0

InfluxDB v2 GA 版本解决了问题。

于 2020-11-25T08:09:55.913 回答