InfluxDB 2.x: Delete data: Unterschied zwischen den Versionen

Aus Wiki-WebPerfect
Wechseln zu: Navigation, Suche
(Die Seite wurde neu angelegt: „ == Influx CLI == <source lang="bash"> influx delete \ --bucket <YOUR_BUCKET> \ --org <YOUR_ORGANISATION> \ --token '<YOUR_TOKEN>' \ --start 1970-01-01…“)
 
 
(6 dazwischenliegende Versionen des gleichen Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
 +
<span style="color:red">'''"Delete data" was first implemented on [https://github.com/influxdata/influxdb/issues/19635 InfluxDB 2.0.3] and higher!'''</span> <br>
 +
If you have an older release then 2.0.3 then following error occures: '''Error: Failed to delete data: Not implemented.''' <br>
 +
  
 
== Influx CLI ==
 
== Influx CLI ==
Zeile 11: Zeile 14:
 
</source>
 
</source>
  
 +
 +
== PowerShell ==
 +
<source lang="powershell">
 +
$Header = @{Authorization = "Token <YOUR_TOKEN>"}
 +
$Body = '{
 +
        "start": "1970-01-01T00:00:00Z",
 +
        "stop": "2023-01-01T00:00:00Z",
 +
        "predicate": "_measurement=\"<MEASUREMENT>\" and <MORE_FILTERS>"
 +
}'
 +
 +
Invoke-WebRequest -Uri 'http://<YOUR_INFLUXDB>:<INFLUXDB_PORT>/api/v2/delete?org=<YOUR_ORG>&bucket=<YOUR_BUCKET>' -Header $Header -Method POST -Body $Body -ContentType "application/json"
 +
</source>
  
  
 +
'''Note:''' If your InfluxDB organisation contains whitespaces, then you have replace the whitespace with "'''+'''".
  
  

Aktuelle Version vom 5. November 2021, 14:37 Uhr

"Delete data" was first implemented on InfluxDB 2.0.3 and higher!
If you have an older release then 2.0.3 then following error occures: Error: Failed to delete data: Not implemented.


Influx CLI

influx delete \
  --bucket <YOUR_BUCKET> \
  --org <YOUR_ORGANISATION> \
  --token '<YOUR_TOKEN>' \
  --start 1970-01-01T00:00:00Z \
  --stop $(date +"%Y-%m-%dT%H:%M:%SZ") \
  --predicate '_measurement="<MEASUREMENT>" and <MORE_FILTERS>'


PowerShell

$Header = @{Authorization = "Token <YOUR_TOKEN>"}
$Body = '{
        "start": "1970-01-01T00:00:00Z",
        "stop": "2023-01-01T00:00:00Z",
        "predicate": "_measurement=\"<MEASUREMENT>\" and <MORE_FILTERS>"
}'
 
Invoke-WebRequest -Uri 'http://<YOUR_INFLUXDB>:<INFLUXDB_PORT>/api/v2/delete?org=<YOUR_ORG>&bucket=<YOUR_BUCKET>' -Header $Header -Method POST -Body $Body -ContentType "application/json"


Note: If your InfluxDB organisation contains whitespaces, then you have replace the whitespace with "+".