Database and retention policy mapping
The InfluxDB 1.x data model includes databases and retention policies. InfluxDB Cloud and InfluxDB OSS 2.1 replace databases and retention policies with buckets. To support InfluxDB 1.x query and write patterns in InfluxDB OSS 2.1 and Cloud, databases and retention policies are mapped to buckets using the database and retention policy (DBRP) mapping service.
The DBRP mapping service uses the database and retention policy specified in 1.x compatibility API requests to route operations to a bucket.
To query data in InfluxQL that was written using the 2.x
you must manually create a DBRP mapping to map a bucket to a database and retention policy.
For more information, see Map unmapped buckets.
Default retention policies
A database can have multiple retention policies with one set as default. If no retention policy is specified in a query or write request, InfluxDB uses the default retention policy for the specified database.
When writing data
When writing data using the
/write compatibility endpoint,
the DBRP mapping service checks for a bucket mapped to the database and retention policy:
- If a mapped bucket is found, data is written to the bucket.
- If an unmapped bucket with a name matching:
- database/retention policy exists, a DBRP mapping is added to the bucket, and data is written to the bucket.
- database exists (without a specified retention policy), the default database retention policy is used, a DBRP mapping is added to the bucket, and data is written to the bucket.
When querying data
When querying data from InfluxDB Cloud and InfluxDB OSS 2.1 using the
/query compatibility endpoint,
the DBRP mapping service checks for the specified database and retention policy
(if no retention policy is specified, the database’s default retention policy is used):
- If a mapped bucket exists, data is queried from the mapped bucket.
- If no mapped bucket exists, InfluxDB returns an error. See how to Map unmapped buckets.
For more information on the DBRP mapping API, see the
/api/v2/dbrps endpoint documentation.
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, the following resources are available:
InfluxDB Cloud and InfluxDB Enterprise customers can contact InfluxData Support.