虽然来自InfluxDB的curl响应是HTTP 200,但系列没有掉线

问题描述 投票:0回答:1

我试图在InfluxDB中使用DROP SERIESWITH语句。我希望使用以下查询删除一些值:

DROP SERIES FROM "measurement_name" WHERE "tag_name"='tag_value'

我是测试的情况,它应该从测量中删除所有值,因为我没有不同的标记。

cURL

curl -i -XPOST 'http://localhost:8086/query?db=testNimble' --data-urlencode 'q=drop series from "pressure" where "unit"='hPa''

Response on InfluxDB Daemon

2019-03-18T18:36:37.818018Z     info    Executing query {"log_id": "0EGWa~nl000", "service": "query", "query": "DROP SERIES FROM pressure WHERE unit = hPa"}
[httpd] 127.0.0.1 - - [18/Mar/2019:19:36:37 +0100] "POST /query?db=testNimble HTTP/1.1" 200 33 "-" "curl/7.35.0" c3b5ba54-49ac-11e9-800e-000000000000 0

Reponse from HTTP

HTTP/1.1 200 OK
Content-Type: application/json
Request-Id: ebd5b2a4-49ab-11e9-800b-000000000000
X-Influxdb-Build: OSS
X-Influxdb-Version: 1.6.1
X-Request-Id: ebd5b2a4-49ab-11e9-800b-000000000000
Date: Mon, 18 Mar 2019 18:30:35 GMT
Transfer-Encoding: chunked

{"results":[{"statement_id":0}]}

但是数据仍然存在:

select * from pressure limit 10

name: pressure
time                unit v
----                ---- -
1545153813714000000 hPa  101997
1545153814761000000 hPa  102004
1545153816045000000 hPa  102006
1545153817203000000 hPa  102003
1545153818265000000 hPa  102003
1545153819446000000 hPa  102003
1545153820498000000 hPa  102004
1545153821680000000 hPa  102007
1545153822854000000 hPa  102003
1545153823904000000 hPa  102003

我尝试重启守护进程,但数据仍然存在。

潮流日志

它提到我试图查询这个

 "query": "DROP SERIES FROM pressure WHERE unit = hPa"

Double Quotes和单引号未在此处转义。

我尝试用escape替换我的查询,如下所示:

 curl -X POST 'http://localhost:8086/query?db=test' --data-urlencode 'q=DROP SERIES WHERE "unit"=\'hPa\' '

它然后要求额外的单引号(为什么?所有报价都关闭)

并且响应抛出错误:

{"error":"error parsing query: found \\, expected identifier, string, number, bool at line 1, char 26"}
curl influxdb
1个回答
0
投票

我能够通过使用bash的多行格式来解决WSL中的这个问题,如下所示:

curl -i -XPOST \
> 'http://localhost:8086/query?db=test' \
> --date-urlencode \
> "q=DROP SERIES FROM WHERE "unit"='hPa'"
© www.soinside.com 2019 - 2024. All rights reserved.