"error":"partial write: max-values-per-tag limit exceeded (100000/100000)

通过 HTTP 方式往 Influxdb 中写入数据提示 max-values-per-tag limit exceeded,原因是超过配置文件中的限制。

报错如下

{"error":"partial write: max-values-per-tag limit exceeded (100000/100000): measurement=\"visit_record\" tag=\"host\" value=\"xx.xx.xx.xx\" dropped=1"}
1

max-values-per-tag 官方含义

The maximum number of tag values allowed per tag key. The default value is 100000 (one hundred thousand). Change the setting to 0 to allow an unlimited number of tag values per tag key. If a tag value causes the number of tag values of a tag key to exceed max-values-per-tag, then InfluxDB will not write the point, and it returns a partial write error. Any existing tag keys with tag values that exceed max-values-per-tag will continue to accept writes, but writes that create a new tag value will fail.

翻译过来就是,每个 tag key 下默认至多有 10W 个 tag value,可以通过将该值设置为0来取消限制。

修改方式

  • 配置文件路径:/etc/influxdb/influxdb.conf
  • 修改配置:max-values-per-tag = 0

重启 influxdb 后,写入就正常了。

注:官方设置这个参数,估计是考虑性能。

reference