Export data from InfluxDB

Export data:

sudo service influxdb start (Or leave this step if service is already running)
influxd backup -database grpcdb /opt/data  

grpcdb is name of DB and back up will be saved under /opt/data directory in this case.

Import Data:

sudo service influxdb stop  (Service should not be running)
influxd restore -metadir /var/lib/influxdb/meta /opt/data
influxd restore -database grpcdb -datadir /var/lib/influxdb/data /opt/data
sudo service influxdb start

You could dump each table and load them through REST interface:

curl "http://hosta:8086/db/dbname/series?u=root&p=root&q=select%20*%20from%20series_name%3B" > series_name.json
curl -XPOST -d @series_name.json "http://hostb:8086/db/dbname/series?u=root&p=root"

Or, maybe you want to add new host to cluster? It's easy and you'll get master-master replica for free. Cluster Setup


If I use curl, I get timeouts, and if I use influxd backup its not in a format I can read.

I'm getting fine results like this:

influx -host influxdb.mydomain.com -database primary -format csv -execute "select time,value from \"continuous\" where channel='ch123'" > outtest.csv

Tags:

Influxdb