ttlapache-iotdb

How to set the different ttl for different batches of time series data inserted into Apache IoTDB?


When inserting data into Apache IoTDB, can I set a personalized TTL for different time series data? For example, I have two batches of data entered into the same database set in IoTDB. I need the first batch of data to have a retention time of two years, and the second batch of data to have a retention time of one month. I checked the official guide on TTL and seems like there's no examples on how to separately set TTL for different data batches. Are there any suggestions on how I can achieve this?


Solution

  • I think you can set a TsFileInsertionEvent in the writing progress of stream processing framework provided in Apache IoTDB. Cooperating with trigger, you can extract your cold data (non-real-time data) from the event and automatically write them into the time series you set by the ttl. The example of setting a writing event can be found in the stream processing framework official guide of IoTDB.