11

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

p0fi
  • 1,056
  • 12
  • 28
  • I'm not sure I understand the question. What would you like to do? – Michael Desa Jun 09 '16 at 20:19
  • I want to collect sensor data into one database from 2 kinds of sensors. Data from type 1 should expire at another age than that from sensor type 2. – p0fi Jun 09 '16 at 20:23

1 Answers1

15

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
Michael Desa
  • 4,607
  • 24
  • 19