InfluxDB 2.x: Map unmapped buckets (DBRP / InfluxDB 1.x compatibility)

Aus Wiki-WebPerfect
Wechseln zu: Navigation, Suche

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).


curl --request POST http://localhost:80/api/v2/dbrps \
  --header "Authorization: Token <YOUR_TOKEN>" \
  --header 'Content-type: application/json' \
  --data '{
        "bucketID": "<YOUR_BUCKET_ID>",
        "database": "<YOUR_DB_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