InfluxDB provides multiple approaches for migrating time-series data between systems or performing backups.
Exporting Data
Command-Line Query Export
The influx command-line interface allows direct querying and exporting of measurements to external files.
influx -database 'target_db' -execute 'SELECT * FROM sensor_data' -format 'csv' > backup.csv
Binary Data Export
The inspection utility can create snapshots of the database storage in text format.
influx_inspect export -datadir /var/lib/influxdb/data -waldir /var/lib/influxdb/wal -out /backup/location/snapshot.txt
REST API Queries
Database contents can be retrieved through HTTP endpoints and stored locally.
curl -G 'http://localhost:8086/query?pretty=true' \
--data-urlencode "db=target_db" \
--data-urlencode "q=SELECT * FROM sensor_data" > results.json
Importing Data
CSV File Loading
Load structured data from comma-separated values files into the database.
influx -import -path=data/input.csv -precision=ms
Batch Text Import
Process large volumes of line protocol formatted data through file input.
influx -import -path=/data/readings.txt -precision=ns
HTTP Write Operations
Insert records programmatically using the write endpoint.
curl -i -XPOST 'http://localhost:8086/write?db=target_db' \
--data-binary @readings.txt
Snapshot Restoration
Restore previously exported binary snapshots back into the system.
influx_inspect import -compressed /backup/snapshot.txt
Supporting Tools
Administrative Interface
Chronograf offers graphical capabilities for managing database migrations through its web dashboard.
Visualization Platform
Grafena integrates with InfluxDB to provide query interfaces that facilitate data extraction workflows.
Collection Agent
Telegraf serves as a collection daemon that can route data streams botth into and out of InfluxDB through configurable plugins.