Export Bucket Data in .CSV format using CLI

Hello, I am trying to export my bucket data as a means to have a backup incase of hardware failure. In CLI I have tried multiple methods of achieving this with the following example being the one I want to use…
influx query ‘from(bucket:“example-bucket”) |> range(start:-1m)’ --raw

When I add my bucket name and accept, I get an error of having more than 1 query string. I also do not know where this script would save the CSV file. Any help would be greatly appreciated.

Hello @JeremyLester,
There is a backup command option for InfluxDB:

You just have to setup the cli first:

the query command doesn’t have a --raw option:

only a file option but that is to read a query from a file.

Also please note that the output of data from InfluxDB is Annotated CSV not CSV. They’re similar but different. You can use the
If you want to write data to a CSV file you can use the v2 OSS UI to do this. After submitting a query you can select the CSV download button. It will write the results to your downloads folder in annotated csv.

Okay, Thank you I will try the Backup command.