文档文档

influx write dryrun

influx write dryrun 命令将写入输出打印到 stdout,而不是写入到 InfluxDB。使用此命令测试写入数据。

支持 line protocolannotated CSVextended annotated CSV。输出始终为 line protocol

用法

influx write dryrun [flags]

标志

标志描述输入类型映射到 ?
-c--active-config用于命令的 CLI 配置string
-b--bucketBucket 名称(与 --bucket-id 互斥)stringINFLUX_BUCKET_NAME
--bucket-idBucket ID(与 --bucket 互斥)stringINFLUX_BUCKET_ID
--configs-pathinflux CLI 配置的路径(默认为 ~/.influxdbv2/configsstringINFLUX_CONFIGS_PATH
--debug将错误输出到 stderr
--encoding输入的字符编码(默认为 UTF-8string
--errors-file用于记录被拒绝的行的错误的文件的路径string
-f--file要导入的文件stringArray
--format输入格式(lpcsv,默认为 lpstring
--header将标题行添加到 CSV 输入数据string
-h--helpdryrun 命令的帮助
--hostInfluxDB 的 HTTP 地址(默认为 https://127.0.0.1:9999stringINFLUX_HOST
--max-line-length单行可读取的最大字节数(默认为 16000000integer
-o--org组织名称(与 --org-id 互斥)stringINFLUX_ORG
--org-id组织 ID(与 --org 互斥)stringINFLUX_ORG_ID
-p--precision时间戳的精度(默认为 nsstringINFLUX_PRECISION
--rate-limit限制写入速率(例如:5MB/5min1MB/s)。string
--skip-verify跳过 TLS 证书验证INFLUX_SKIP_VERIFY
--skipHeader跳过输入数据的前ninteger
--skipRowOnError将 CSV 错误输出到 stderr,但继续处理
-t--tokenAPI 令牌stringINFLUX_TOKEN
-u--url要从中导入数据的 URLstringArray

示例

身份验证凭据

以下示例假定您的 InfluxDB hostorganizationtoken活动的 influx CLI 配置 或环境变量(INFLUX_HOSTINFLUX_ORGINFLUX_TOKEN)提供。如果您没有设置 CLI 配置或环境变量,请为每个命令包含以下必需的凭据

  • --host: InfluxDB host
  • -o, --org--org-id: InfluxDB 组织名称或 ID
  • -t, --token: InfluxDB API 令牌

Line protocol

Dry run 写入 line protocol 通过 stdin
influx write --bucket example-bucket "
m,host=host1 field1=1.2
m,host=host2 field1=2.4
m,host=host1 field2=5i
m,host=host2 field2=3i
"
Dry run 写入 line protocol 从文件
influx write dryrun \
  --bucket example-bucket \
  --file path/to/line-protocol.txt
Dry run 写入 line protocol 从多个文件
influx write dryrun \
  --bucket example-bucket \
  --file path/to/line-protocol-1.txt \
  --file path/to/line-protocol-2.txt
Dry run 写入 line protocol 从 URL
influx write dryrun \
  --bucket example-bucket \
  --url https://example.com/line-protocol.txt
Dry run 写入 line protocol 从多个 URL
influx write dryrun \
  --bucket example-bucket \
  --url https://example.com/line-protocol-1.txt \
  --url https://example.com/line-protocol-2.txt
Dry run 写入 line protocol 从多个来源
influx write dryrun \
  --bucket example-bucket \
  --file path/to/line-protocol-1.txt \
  --url https://example.com/line-protocol-2.txt

CSV

Dry run 写入 annotated CSV 数据 通过 stdin
influx write dryrun \
  --bucket example-bucket \
  --format csv \
  "#datatype measurement,tag,tag,field,field,ignored,time
m,cpu,host,time_steal,usage_user,nothing,time
cpu,cpu1,host1,0,2.7,a,1482669077000000000
cpu,cpu1,host2,0,2.2,b,1482669087000000000
"
Dry run 写入 annotated CSV 数据 从文件
influx write dryrun \
  --bucket example-bucket \
  --file path/to/data.csv
Dry run 写入 annotated CSV 数据 从多个文件
influx write dryrun \
  --bucket example-bucket \
  --file path/to/data-1.csv \
  --file path/to/data-2.csv
Dry run 写入 annotated CSV 数据 从 URL
influx write dryrun \
  --bucket example-bucket \
  --url https://example.com/data.csv
Dry run 写入 annotated CSV 数据 从多个 URL
influx write dryrun \
  --bucket example-bucket \
  --url https://example.com/data-1.csv \
  --url https://example.com/data-2.csv
Dry run 写入 annotated CSV 数据 从多个来源
influx write dryrun \
  --bucket example-bucket \
  --file path/to/data-1.csv \
  --url https://example.com/data-2.csv
Dry run 预先添加带注释的 CSV 数据与注释标题
influx write dryrun \
  --bucket example-bucket \
  --header "#constant measurement,birds" \
  --header "#datatype dataTime:2006-01-02,long,tag" \
  --file path/to/data.csv

此页面是否对您有帮助?

感谢您的反馈!


Flux 的未来

Flux 将进入维护模式。您可以继续像现在一样使用它,而无需对代码进行任何更改。

阅读更多

InfluxDB 3 开源版本现在处于公开 Alpha 阶段

InfluxDB 3 开源版本现已发布以供 alpha 测试,并根据 MIT 或 Apache 2 许可授权。

我们发布了两个产品作为 alpha 版本的一部分。

InfluxDB 3 Core 是我们新的开源产品。它是一个用于时间序列和事件数据的最新数据引擎。 InfluxDB 3 Enterprise 是一个构建在 Core 基础之上的商业版本,增加了历史查询功能、读取副本、高可用性、可扩展性和细粒度的安全性。

有关如何开始使用的更多信息,请查看