Hello,
I am new to InfluxDB.
I am trying to write historical data from mysql table to influxdb. Is there any way to use Telegraf for this case? (I tried but I could write only real-time events from mysql instead of data from my table.)
If not, do you have any ideas how to send historical data to influxdb easily?
Please advise. Thank you!
Regards,
Aleksandra
As far as I know, there is no input plugin for Telegraf that allows you to import historical data from a MySQL database.
In principle, of course, a timestamp should be available for the entries in the MySQL database.
What comes to my mind quickly:
- write a script that exports the data from the MySQL database and saves it in the influx line protocol format. The format is quite simple. Then import the file into InfluxDB.
- write an
inputs.exec
or inputs.execd
plugin for Telegraf that exports the data from the MySQL database
- without Telegraf, query the MySQL database directly from InfluxDB with flux
sql.from()
The following links as a suggestion:
https://docs.influxdata.com/influxdb/v2.0/write-data/
https://docs.influxdata.com/influxdb/v2.0/reference/flux/stdlib/sql/from/
https://docs.influxdata.com/telegraf/v1.17/plugins/#exec
Thank You @Franky1 ! You helped me a lot.
Hi could someone advice me on how to pull data from mysql database using telegraf please. Ideally I would like them to be published on cloud watch.