4

I have an influxdb database named metrics, I want to export it as a JSON file with its entire data.

directory = '/var/lib/influxdb/data'

I can save the list of tag keys:

influx -execute='show tag keys' -database=metrics -format=json -pretty=true > /home/ivms/metrics.json

but how can I save all tags with all values?

1
  • Hi,have you solved this problem? Commented Feb 4, 2019 at 6:51

1 Answer 1

2

The query to return all data from all measurements in the database, including both fields and tags, would be:

SELECT * FROM /.*/

The full command line:

influx -database=metrics -format=json -pretty=true  \
    -execute='SELECT * FROM /.*/'  \
    > ~/metrics.json

NOTE:

If your database is complicated (millions of series) you might have to wait a long time for influx to actually respond, in my case it was almost 30min but it worked.

Also Make sure you give the system a large enough swap, to avoid getting OOM killed.

Sign up to request clarification or add additional context in comments.

2 Comments

This must be v1 command set. Doesn't work on current rev.
Indeed it's been tested on v1.8. I don't have a v2 instance to test on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.