使用 Influx 查询命令
使用influx query 命令通过Flux查询InfluxDB中的数据。将Flux查询作为文件或通过stdin传递给命令。
从文件运行查询
influx query --file /path/to/query.flux
通过stdin管道传递原始Flux
influx query - # Return to open the pipe
data = from(bucket: "example-bucket") |> range(start: -10m) # ...
# Linux & macOS: <ctrl-d> to close the pipe and submit the command
# Windows: <enter>, then <ctrl-d>, then <enter> to close the pipe and submit the command
在大型数据集中删除不必要的列
当使用 influx query 命令查询和下载大型数据集时,删除诸如 _start 和 _stop 等列以优化下载文件大小。
// ...
|> drop(columns: ["_start", "_stop"])