如何使用 InfluxDB 客户端库将数据加载到 QuestDB 中?

问题描述 投票:0回答:1

我有很多使用 InfluxDB Java 客户端编写的代码,但希望将我的数据库迁移到 QuestDB,而无需更改我的代码。 InfluxDB 客户端库使用 HTTP 作为传输方法,使用 InfluxDB 线路协议 (ILP) 作为序列化格式,但 QuestDB 使用 TCP 进行传输和序列化。因此,开箱即用的客户端与 QuestDB 不兼容,即使它们都支持 ILP。如何在不更改任何代码的情况下将数据导入 QuestDB?

influxdb questdb influx-line-protocol
1个回答
0
投票

要重用使用 InfluxDB 库编写的任何代码,您需要一个组件将 HTTP 请求转换为 TCP。幸运的是,有 Telegraf 可以为我们做到这一点!

您需要将 Telegraf 设置为 InfluxDB 客户端和 QuestDB 之间的中间人。这是一个使用 InfluxDB 输入和 QuestDB 输出设置的

telegraf.conf

# 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"

Github 上有一个工作示例,并且在 a QuestDB 问题

中也有更多描述
© www.soinside.com 2019 - 2024. All rights reserved.