InfluxDB 2.x: Map unmapped buckets (DBRP / InfluxDB 1.x compatibility): Unterschied zwischen den Versionen
Aus Wiki-WebPerfect
Admin (Diskussion | Beiträge) |
Admin (Diskussion | Beiträge) |
||
Zeile 15: | Zeile 15: | ||
''Source: https://docs.influxdata.com/influxdb/v2.0/query-data/influxql/#map-unmapped-buckets'' | ''Source: https://docs.influxdata.com/influxdb/v2.0/query-data/influxql/#map-unmapped-buckets'' | ||
+ | |||
+ | |||
+ | |||
+ | == List all retention policy mappings == | ||
+ | curl --request GET http://localhost:80/api/v2/dbrps?orgID=<YOUR_ORGANISATION_ID> \ | ||
+ | --header "Authorization: Token <YOUR_TOKEN>" \ | ||
Zeile 27: | Zeile 33: | ||
"retention_policy": "<YOUR_RETENTION_POLICY_FOR_MAPPING>" | "retention_policy": "<YOUR_RETENTION_POLICY_FOR_MAPPING>" | ||
}' | }' | ||
− | |||
− | |||
− | |||
− | |||
− | |||
Version vom 3. Dezember 2020, 17:18 Uhr
If you want to query an InfluxDB 2.x with the query language InfluxQL you have to create a map for your bucket.
In InfluxDB 1.x, data is stored in databases and retention policies. In InfluxDB OSS 2.0, data is stored in buckets. Because InfluxQL uses the 1.x data model, before querying in InfluxQL, a bucket must be mapped to a database and retention policy (DBRP).
If you don't create this mapping, an error will occurs, because influx can't find the database.
curl --request POST http://localhost:<YOUR_CONFIGURED_INFLUX_PORT>/api/v2/dbrps \ --header "Authorization: Token <YOUR_TOKEN>" \ --header 'Content-type: application/json' \ --data '{ "bucketID": "<YOUR_BUCKET_ID>", "database": "<YOUR_BUCKET_NAME>", "default": true, "orgID": "<YOUR_ORGANISATION_ID>", "retention_policy": "<YOUR_RETENTION_POLICY_FOR_MAPPING>" }'
Source: https://docs.influxdata.com/influxdb/v2.0/query-data/influxql/#map-unmapped-buckets
List all retention policy mappings
curl --request GET http://localhost:80/api/v2/dbrps?orgID=<YOUR_ORGANISATION_ID> \ --header "Authorization: Token <YOUR_TOKEN>" \
Remove a retention policy mapping
curl --request DELETE http://localhost:<YOUR_CONFIGURED_INFLUX_PORT>/api/v2/dbrps \ --header "Authorization: Token <YOUR_TOKEN>" \ --header 'Content-type: application/json' \ --data '{ "dbrpId": "<YOUR_DBRP_ID>", "orgID": "<YOUR_ORGANISATION_ID>", "retention_policy": "<YOUR_RETENTION_POLICY_FOR_MAPPING>" }'