Package org.apache.beam.sdk.io.influxdb
Class InfluxDbIO
- java.lang.Object
-
- org.apache.beam.sdk.io.influxdb.InfluxDbIO
-
public class InfluxDbIO extends java.lang.ObjectIO to read and write from InfluxDB.Reading from InfluxDB
InfluxDB return a bounded collection of String as
PCollection<String>. The String follows the line protocol (https://docs.influxdata.com/influxdb/v1.8/write_protocols/line_protocol_tutorial/). To Configure the InfluxDB source, you have to provide the connection URL, the credentials to connect to InfluxDB and the Database namepipeline.apply( InfluxDbIO.read() .withDataSourceConfiguration(DataSourceConfiguration.create(StaticValueProvider.of(options.getInfluxDBURL()), StaticValueProvider.of(options.getInfluxDBUserName()), StaticValueProvider.of(options.getInfluxDBPassword()))) .withDatabase("metrics") .withQuery("select * from metric");Writing to InfluxDB
InfluxDB sink supports writing data (as line protocol) to InfluxDB To configure a InfluxDB sink, you must specify a URL
InfluxDBURL,userName,password,databasepipeleine .apply(...) .appply(InfluxDbIO.write() .withDataSourceConfiguration(DataSourceConfiguration.create(StaticValueProvider.of(options.getInfluxDBURL()), StaticValueProvider.of(options.getInfluxDBUserName()), StaticValueProvider.of(options.getInfluxDBPassword())));The source and sink also accepts optional configuration:
withRetentionPolicy()
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classInfluxDbIO.DataSourceConfigurationA POJO describing a DataSourceConfiguration such as URL, userName and password.static classInfluxDbIO.ReadAPTransformto read from InfluxDB metric or data related to query.static classInfluxDbIO.WriteAPTransformto write to a InfluxDB datasource.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.influxdb.InfluxDBgetConnection(InfluxDbIO.DataSourceConfiguration configuration, boolean disableCertificateValidation)static InfluxDbIO.Readread()static InfluxDbIO.Writewrite()
-
-
-
Method Detail
-
write
public static InfluxDbIO.Write write()
-
read
public static InfluxDbIO.Read read()
-
getConnection
public static org.influxdb.InfluxDB getConnection(InfluxDbIO.DataSourceConfiguration configuration, boolean disableCertificateValidation)
-
-