-
Notifications
You must be signed in to change notification settings - Fork 1
Document InfluxDB I/O procedures #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4b6684e
Adding docs on Influxio
matkuliak b2796f2
Apply suggestions from code review
matkuliak d27ec7e
added to index and toc
matkuliak b1afa54
fix outdated link
matkuliak 1e60125
sort links alphabetically
matkuliak fa9a5c3
address suggestions
matkuliak 5509400
forgot code wrap
matkuliak 27a8547
Update docs/integrate/etl/influxdb.md
matkuliak 3e59a16
Update docs/integrate/etl/influxdb.md
matkuliak 156ba15
dockerize rest of the setup
matkuliak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
(integrate-influxdb)= | ||
(import-influxdb)= | ||
# Import data from InfluxDB | ||
|
||
In this quick tutorial we use the InfluxDB I/O subsystem of CrateDB Toolkit | ||
to import data from InfluxDB into CrateDB. | ||
|
||
(integrate-influxdb-quickstart)= | ||
## Quickstart | ||
|
||
There are multiple ways to get and use the this tool, to avoid | ||
unnecessary installations we will use Docker to run the services. | ||
**Docker is needed for this:** | ||
|
||
:::{code} console | ||
docker run --rm --network=host ghcr.io/daq-tools/influxio \ | ||
influxio copy \ | ||
"http://example:token@localhost:8086/testdrive/demo" \ | ||
"crate://crate@localhost:4200/testdrive/demo" | ||
::: | ||
|
||
(setup-influxdb)= | ||
### InfluxDB setup | ||
|
||
Following is an example configuration of InfluxDB and some sample data | ||
should you need it. **Prerequisite for these to work is a running | ||
instance of InfluxDB.** | ||
|
||
Initial InfluxDB configuration: | ||
|
||
:::{code} console | ||
docker run --rm -it --publish=8086:8086 --name influxdb\ | ||
--env=DOCKER_INFLUXDB_INIT_MODE=setup \ | ||
--env=DOCKER_INFLUXDB_INIT_USERNAME=user1 \ | ||
--env=DOCKER_INFLUXDB_INIT_PASSWORD=secret1234 \ | ||
--env=DOCKER_INFLUXDB_INIT_ORG=example \ | ||
--env=DOCKER_INFLUXDB_INIT_BUCKET=testdrive \ | ||
--env=DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=token \ | ||
--volume="$PWD/var/lib/influxdb2:/var/lib/influxdb2" \ | ||
influxdb:latest | ||
::: | ||
|
||
Write sample data to InfluxDB: | ||
|
||
:::{code} console | ||
docker exec influxdb influx write --bucket=testdrive --org=example --precision=s --token=token "demo,region=amazonas temperature=27.4,humidity=92.3,windspeed=4.5 1588363200" | ||
docker exec influxdb influx write --bucket=testdrive --org=example --precision=s --token=token "demo,region=amazonas temperature=28.2,humidity=88.7,windspeed=4.7 1588549600" | ||
docker exec influxdb influx write --bucket=testdrive --org=example --precision=s --token=token "demo,region=amazonas temperature=27.9,humidity=91.6,windspeed=3.2 1588736000" | ||
docker exec influxdb influx write --bucket=testdrive --org=example --precision=s --token=token "demo,region=amazonas temperature=29.1,humidity=88.1,windspeed=2.4 1588922400" | ||
docker exec influxdb influx write --bucket=testdrive --org=example --precision=s --token=token "demo,region=amazonas temperature=28.6,humidity=93.4,windspeed=2.9 1589108800" | ||
|
||
::: | ||
|
||
(export-data)= | ||
### Export | ||
|
||
Now you can export the data into CrateDB. **Prerequisite for these to work | ||
is a running instance of CrateDB.** | ||
|
||
First, create these aliases so the next part is a bit easier: | ||
|
||
::::{code} console | ||
alias crash="docker run --rm -it ghcr.io/crate-workbench/cratedb-toolkit:latest crash" | ||
alias ctk="docker run --rm -it ghcr.io/crate-workbench/cratedb-toolkit:latest ctk" | ||
::: | ||
|
||
:::{code} console | ||
export CRATEDB_SQLALCHEMY_URL=crate://crate@localhost:4200/testdrive/demo | ||
ctk load table influxdb2://example:token@localhost:8086/testdrive/demo | ||
::: | ||
|
||
And verify that data is indeed in your CrateDB cluster: | ||
|
||
:::{code} console | ||
crash --command "SELECT * FROM testdrive.demo;" | ||
::: | ||
Comment on lines
+74
to
+76
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the OCI image of Toolkit also includes |
||
|
||
## More information | ||
|
||
There are many more ways to apply the I/O subsystem of CrateDB Toolkit as | ||
pipeline elements in your daily data operations routines. Please visit the | ||
[CrateDB Toolkit I/O Documentation], to learn more about what's possible. | ||
|
||
The InfluxDB I/O subsystem is based on the [influxio] package. Please also | ||
check its documentation to learn about more of its capabilities, supporting | ||
you when working with InfluxDB. | ||
|
||
[influxio]: https://influxio.readthedocs.io/ | ||
[CrateDB Toolkit I/O Documentation]: https://cratedb-toolkit.readthedocs.io/io/influxdb/loader.html |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.