Best way to migrate data from mysql to influxdb

What is the best way to migrate data from mysql to influxDB ?

I want to update the column names before migration. eg,
I have table like mySQLTable1 with three columns column_A, column_B, column_C.
After migration the influx field names should be like max_column_A, min_column_B, avg_column_C.

@aditya What version of InfluxDB are you using?

@scott We are using v1.7.7

With 1.7.x, you have to write some type of script that queries the MySQL data and converts the results into line protocol so they can be written to InfluxDB.

If you were using InfluxDB 2.0, you can use the Flux sql package and the sql.from() function to query the data from MySQL, transform it in whatever way you need, then write it into InfluxDB 2.0 with the to() function.

@scott Oh… I attended the Influx days 2019 at San francisco. I am under the impression that InfluxDB 2.0 is in evolution phase and available for cloud users. Because of many new features, we wanted to use InfluxDB 2.0. Now because of this issue I again want to go for Influx 2.0.

Is non-cloud version of Influx2.0 available now ?

As I know, influx 1.7.x can not be upgraded to Influx2.0. It will need data migration from 1.7.x to Influx2.0…

Will there be further patch releases (if necessary) for V1.7.x or we will have to go for 2.x?

InfluxDB 2.0 OSS is still in alpha, but will likely be going into beta soon. InfluxDB Cloud 2.0 is available. There currently isn’t an upgrade path from 1.x to 2.0, but it’s being designed and built. There will be more patch releases of 1.7 (a 1.7.10 release candidate is in the works) and 1.8 should roll out sometime next year (2020).

@scott It looks like our decision to use 1.7.x is prudent. I will go ahead and write a script to perform the migration task. Thanks a lot for all the details.

@aditya One other thing to note - In order to write data to InfluxDB, it must have a timestamp (InfluxDB will use the time of the write request if one isn’t included), a measurement, and a field. InfluxDB will reject the data if it doesn’t have all of those.

Another option is to leave the data in MySQL and use Flux (supported in InfluxDB 1.7) and the sql package to query data from MySQL and join it with data in InfluxDB. With 1.7, you won’t be able to write the results back into InfluxDB, but you can see the joined results.