Load data from InfluxDB¶
In this quick usage guide, you will use the CrateDB Toolkit InfluxDB I/O adapter to import data from InfluxDB into CrateDB. You can also import data directly from files in InfluxDB line protocol format.
Prerequisites¶
Use Docker or Podman to run all components. This approach works consistently across Linux, macOS, and Windows.
Files¶
First, download and save all required files to your machine.
Services¶
Start services using Docker Compose or Podman Compose.
If you use Podman, replace docker with podman (or enable the podman‑docker
compatibility shim) and run podman compose up.
docker compose up
Submit data¶
Write a few sample records to InfluxDB.
docker compose exec influxdb influx write --bucket=testdrive --org=example --token=token --precision=s "demo,region=amazonas temperature=27.4,humidity=92.3,windspeed=4.5 1588363200"
docker compose exec influxdb influx write --bucket=testdrive --org=example --token=token --precision=s "demo,region=amazonas temperature=28.2,humidity=88.7,windspeed=4.7 1588549600"
docker compose exec influxdb influx write --bucket=testdrive --org=example --token=token --precision=s "demo,region=amazonas temperature=27.9,humidity=91.6,windspeed=3.2 1588736000"
docker compose exec influxdb influx write --bucket=testdrive --org=example --token=token --precision=s "demo,region=amazonas temperature=29.1,humidity=88.1,windspeed=2.4 1588922400"
docker compose exec influxdb influx write --bucket=testdrive --org=example --token=token --precision=s "demo,region=amazonas temperature=28.6,humidity=93.4,windspeed=2.9 1589108800"
Invoke the data transfer pipeline, importing data from InfluxDB bucket/measurement into CrateDB schema/table.
docker compose run --rm --no-TTY cratedb-toolkit ctk load "influxdb2://example:token@influxdb:8086/testdrive/demo" "crate://crate@cratedb:4200/doc/influxdb_demo"
Explore data¶
Inspect data stored in CrateDB.
docker compose exec cratedb crash -c "SELECT * FROM doc.influxdb_demo"
+---------------+----------+----------+-------------+-----------+
| time | region | humidity | temperature | windspeed |
+---------------+----------+----------+-------------+-----------+
| 1588549600000 | amazonas | 88.7 | 28.2 | 4.7 |
| 1588363200000 | amazonas | 92.3 | 27.4 | 4.5 |
+---------------+----------+----------+-------------+-----------+
SELECT 2 rows in set (0.027 sec)