使用 Telegraf 双写数据到 InfluxDB
使用 Telegraf 将您的数据同时写入到多个 InfluxDB 实例或集群。这种方法,称为“双写”,对于将数据备份到单独的实例或从其他版本的 InfluxDB 迁移到 InfluxDB 3 Core 非常有用。
以下示例配置 Telegraf 以双写数据到 InfluxDB 3 Core 和 InfluxDB v2 OSS 实例。
InfluxDB v2 输出插件 两次配置——第一次指向 InfluxDB 3 Core,另一次指向 InfluxDB v2 OSS 实例。
两个不同的令牌——一个用于 InfluxDB v2 OSS,另一个用于 InfluxDB 3 Core。将两个令牌都配置为环境变量,并在您的 Telegraf 配置文件中使用字符串插值来引用每个环境变量。
虽然 InfluxDB 3 Core 仍处于 Beta 阶段,但它不需要授权令牌。对于
token
选项,请提供任意非空令牌字符串。
示例配置
# Include any other input, processor, or aggregator plugins that you want to
# include in your configuration.
# Send data to InfluxDB 3 Core
[[outputs.influxdb_v2]]
## The InfluxDB 3 Core URL
urls = ["http://localhost:8181"]
## InfluxDB 3 Core authorization token
token = "${INFLUX_TOKEN}"
## For InfluxDB 3 Core, set organization to an empty string
organization = ""
## Destination database to write into
bucket = "DATABASE_NAME"
# Send data to InfluxDB v2 OSS
[[outputs.influxdb_v2]]
## The InfluxDB v2 OSS URL
urls = ["http://localhost:8086"]
## OSS token for authentication
token = "${INFLUX_TOKEN_OSS}"
## Organization is the name of the organization you want to write to.
organization = "ORG_NAME_OSS"
## Destination bucket to write to
bucket = "BUCKET_NAME_OSS"
Telegraf 允许您使用 influxdb
(InfluxDB v1) 和 influxdb_v2
输出插件 将数据双写到任何版本的 InfluxDB。单个 Telegraf 代理将相同的数据集发送到所有目标输出。您无法根据输出过滤数据。
InfluxDB v1 *不* 支持无符号整数数据类型。您只能将无符号整数字段值写入到基于 InfluxDB v2 和 3 的产品。
此页是否对您有帮助?
感谢您的反馈!
支持和反馈
感谢您成为我们社区的一份子!我们欢迎并鼓励您提供关于 InfluxDB 3 Core 和本文档的反馈和错误报告。要获取支持,请使用以下资源
**拥有年度或支持合同的客户** 可以联系 InfluxData 支持。