Is it possible to treat different measurements in influxdb with different a retention policy?
8
votes
1 Answers
13
votes
This is entirely possible with InfluxDB. To do this you'll need to create a database that has two retention policies and then write the data to the associated retention policy.
Example:
$ influx
> create database mydb
> create retention policy rp_1 on mydb duration 1h replication 1
> create retention policy rp_2 on mydb duration 2h replication 1
Now that our retention policies have been created we simple write data in the following manner:
Sensor 1 will write data to rp_1
curl http://localhost:8086/write?db=mydb&rp=rp_1 --data-binary SOMEDATA
Sensor 2 will write data to rp_2
curl http://localhost:8086/write?db=mydb&rp=rp_2 --data-binary SOMEDATA