Move the data from one bucket to another bucket

I am using the InfluxDB docker container 2.0.9.
I am getting the data from the Kafka broker every 5 mins which we are reading from the telegraf and writing into the InfluxDB.

In InfluxDB, we usually perform all the operations on the last 30 days’ data, but now our whole data is going into the same bucket.
We currently have more than 1 year of data in the same bucket, querying the data from the same puts an extra load on the CPU and takes more time to query.

We are thinking to move the data into different buckets on monthly basis.
Like we can create different buckets based on the month and year like
and these buckets will have data according to the month.
The main bucket bucket_name will have the current data.
I want to run write the data into the different buckets using InfluxDB CLI which I am able to do.

In the main bucket, I don’t want to keep data for more than one month so after copying the data from the main bucket to other buckets I want to delete the data from the main bucket.
I know we can delete the data using Delete data | InfluxDB OSS 2.5 Documentation
but is there any flux function that can move the data across different buckets not copy?


@Anaisdg could you please help?

Hi @Ravikant_Gautam,
There sadly isn’t this is usually the job of the bucket retention policy. You could call the API during your flux query but I believe writing a script to run against the CLI would do a better job.