Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export data from InfluxDB

Tags:

influxdb

Is there a way (plugin or tool) to export the data from the database (or database itself) ? I'm looking for this feature as I need to migrate a DB from present host to another one.

like image 993
Srikanta Avatar asked Jan 05 '15 12:01

Srikanta


People also ask

How does InfluxDB send data?

Writing points from a fileWrite points from a file by passing @filename to curl . The data in the file should follow the InfluxDB line protocol syntax. Note: If your data file has more than 5,000 points, it may be necessary to split that file into several files in order to write your data in batches to InfluxDB.

Is there any GUI for InfluxDB?

The built-in web administration GUI is a simple way to interact with InfluxDB. For any significant use, whether writing or querying data, the HTTP API (reading, writing) or the command line interface are better options.

Is InfluxDB a SQL database?

InfluxDB is similar to a SQL database, but different in many ways. InfluxDB is purpose-built for time series data. Relational databases can handle time series data, but are not optimized for common time series workloads.


2 Answers

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 
like image 146
Ammad Avatar answered Nov 12 '22 07:11

Ammad


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

like image 39
ezotrank Avatar answered Nov 12 '22 05:11

ezotrank