How can I load data into QuestDB using the InfluxDB Client Library?

49 Views Asked by At

I have a lot of code written using the InfluxDB Java Client, but want to migrate my database to QuestDB without having to change my code. The InfluxDB client libraries use HTTP as a transport method and InfluxDB Line Protocol (ILP) as a serialization format, but QuestDB uses TCP for transport. So out-of-the-box, the client is incompatible with QuestDB, even though they both support ILP.

How can I get my data into QuestDB without changing any of my code?

1

There are 1 best solutions below

0
sklarsa On

To reuse any code written using InfluxDB libraries, you need a component to translate HTTP requests into TCP. Luckily, there's Telegraf which can do this for us!

You need to set up Telegraf as a middleman in between your InfluxDB client and QuestDB. Here is a telegraf.conf that is set up with an InfluxDB input and QuestDB output:

# Accept metrics over InfluxDB 2.x HTTP API
[[inputs.influxdb_v2_listener]]
  ## Address and port to host InfluxDB listener on
  ## (Double check the port. Could be 9999 if using OSS Beta)
  service_address = ":8086"

[[outputs.socket_writer]]
  ## Address and port to write to
  address = "tcp://questdb.questdb.svc:9009"

There is a working example on Github here and this is also described more in a QuestDB issue