iot/docs/influxdb.md
2024-07-04 11:26:30 +08:00

1.5 KiB

官方文档地址

https://docs.influxdata.com/influxdb/v2/reference/cli/influx/delete/

数据删除

influx delete --org nannong  --bucket metric --start '1970-01-01T00:00:00Z'  --stop $(date --utc +"%Y-%m-%dT%H:%M:%SZ")  --token "A-ZRjqMK_7NR45lXXEiR7AEtYCd1ETzq9Z61FTMQLb5O4-1hSf8sCrjdPB84e__xsrItKHL3qjJALgbYN-H_VQ=="

demo

    Authentication credentials
    The examples below assume your InfluxDB host, organization, and token are provided by either the active influx CLI configuration or by environment variables (INFLUX_HOST, INFLUX_ORG, and INFLUX_TOKEN). If you do not have a CLI configuration set up or the environment variables set, include these required credentials for each command with the following flags:

    --host: InfluxDB host
    -o, --org or --org-id: InfluxDB organization name or ID
    -t, --token: InfluxDB API token

    Delete all points in a measurement
    influx delete \
    --bucket example-bucket \
    --start 1970-01-01T00:00:00Z \
    --stop $(date --utc +"%Y-%m-%dT%H:%M:%SZ") \
    --predicate '_measurement="example-measurement"'

    Delete points in a measurement with a specific tag value
    influx delete \
    --bucket example-bucket \
    --start 1970-01-01T00:00:00Z \
    --stop $(date --utc +"%Y-%m-%dT%H:%M:%SZ") \
    --predicate '_measurement="example-measurement" AND host="old-host"'

    Delete all points within a specified time frame

    influx delete \
    --bucket example-bucket \
    --start 2020-03-01T00:00:00Z \
    --stop 2020-11-14T00:00:00Z