Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I create different retention policy for different measurements in influxdb?

Tags:

influxdb

Is it possible to treat different measurements in influxdb with different a retention policy?

like image 368
p0fi Avatar asked Jun 09 '16 14:06

p0fi


1 Answers

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
like image 195
Michael Desa Avatar answered Sep 21 '22 15:09

Michael Desa