Dump data from InfluxDB cloud serverless

Hi,

I’m trying to figure out a way to dump my data from a specific bucket out of my InfluxDb cloud server-less offering to replicate it locally.

Can someone help me about how to approach this and point me to the docs too?

Thanks
Amaan

@akhan4u You’ll have to query the data out of your Serverless instance and write it to your local instance. One thing to note is that InfluxDB Cloud Serverless and InfluxDB OSS v2 use different storage engines and even query languages (SQL and InfluxQL for Serverless, Flux and InfluxQL for OSS v2).

Technically, you can still use Flux to query data in InfluxDB Cloud Serverless, but because Flux was designed for a different storage engine, Flux queries are much less performant. In this case, it still might be the simplest way.

Serverless does have rate limits that will likely prevent you from querying out your data all at once, so you’ll have to split it up into time-based batches. The batch interval depends on how “dense” your data is.

If you run the following query (with the placeholders replaced) from your local InfluxDB instance, it should query the data from your Serverless instance and store it locally. I say “should” because I haven’t tested it myself.

from(bucket: "SERVERLESS_BUCKET", host: "INFLUXDB_CLOUD_URL", token: "SERVERLESS_TOKEN", orgID: "SERVERLESS_ORG_ID")
    |> range(start: BATCH_START, stop: BATCH_STOP)
    |> to(bucket: "YOUR_LOCAL_BUCKET")

It’ll likely take some testing to get the batch size right, but query data in batches until it’s all moved down.