public class InfluxDbIO
extends java.lang.Object
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 name
pipeline.apply(
InfluxDbIO.read()
.withDataSourceConfiguration(DataSourceConfiguration.create(StaticValueProvider.of(options.getInfluxDBURL()),
StaticValueProvider.of(options.getInfluxDBUserName()),
StaticValueProvider.of(options.getInfluxDBPassword())))
.withDatabase("metrics")
.withQuery("select * from metric");
InfluxDB sink supports writing data (as line protocol) to InfluxDB To configure a InfluxDB
sink, you must specify a URL InfluxDBURL
, userName
, password
, database
pipeleine
.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()
Modifier and Type | Class and Description |
---|---|
static class |
InfluxDbIO.DataSourceConfiguration
A POJO describing a DataSourceConfiguration such as URL, userName and password.
|
static class |
InfluxDbIO.Read
A
PTransform to read from InfluxDB metric or data related to query. |
static class |
InfluxDbIO.Write
A
PTransform to write to a InfluxDB datasource. |
Modifier and Type | Method and Description |
---|---|
static InfluxDB |
getConnection(InfluxDbIO.DataSourceConfiguration configuration,
boolean disableCertificateValidation) |
static InfluxDbIO.Read |
read() |
static InfluxDbIO.Write |
write() |
public static InfluxDbIO.Write write()
public static InfluxDbIO.Read read()
public static InfluxDB getConnection(InfluxDbIO.DataSourceConfiguration configuration, boolean disableCertificateValidation)