首页/数据/NoSQL 速查/InfluxDB line protocol 行协议

InfluxDB line protocol 行协议

行协议是 InfluxDB 的写入格式:measurement,tag=value 空格 field=value 空格 可选时间戳;时间戳默认纳秒,不传则由服务端补当前时间。

NoSQL 速查数据更新于 2026-10-12
格式<measurement>[,<tag_key>=<tag_value>…] <field_key>=<field_value>[,…] [<timestamp>]
类型field 值:浮点 1.0、整数 1i、布尔 true、字符串 "text"
时间戳默认纳秒(precision 参数可指定 s/ms/us/ns)

示例

示例
cpu,host=web-1,region=cn usage=0.73,idle=99.2 1719792000000000000
http_requests,service=api,code=200 count=42i 1719792000000000000
temperature,room=office value=23.5
weather,location=us-midwest temperature="sunny" 1719792000000000000
同一行里多个 field 会写入同一个点;field 顺序与类型在同一 measurement 的同一分片周期内需保持一致。

易错点

  • field 类型在同一分片内变更(如 1 变 "1")会导致写入被拒绝,产生 field type conflict 错误
  • 行协议的时间戳单位默认纳秒,误传秒级时间戳会被当成 1970 年附近的时间

数据来源与参考

  • InfluxData Docs: Line protocol
​‌‌​​‌​​​‌‌​‌‌‌‌​‌‌​​​‌‌​‌‌‌​​‌‌​​‌​‌‌‌​​‌‌‌​​​‌​‌‌​‌​​‌​‌‌‌​​​‌​‌‌​‌​​‌​‌‌​​​‌‌​‌‌‌​‌​​​‌‌​‌‌‌‌​​‌​‌‌‌​​‌‌​​​‌‌​‌‌​‌‌‌‌​‌‌​‌‌​‌