InfluxDB写入失败-partial write: max-values-per-tag limit exceeded


2016-12-02 20:47:11.485 [] [] [] ERROR c.y.t.p.m.m.i.OrderCreateMonitorManageImpl - InfluxDB写入异常!influxDO=InfluxDO(, timeStamp=1480682831481, tagKeyList=[cluster, host, count_time, count, count_type], tagValList=[DEFAULT_CLUSTER,, 1480682831481, 3, bill_new], fieldKeyList=[result, cost], fieldValList=[true, 112]), exception={}
java.lang.RuntimeException: {"error":"partial write: max-values-per-tag limit exceeded (100000/100000): measurement=\"\" tag=\"count_time\" value=\"count_time\" dropped=1"}
at org.influxdb.impl.InfluxDBImpl.execute( ~[influxdb-java-2.4.jar:na]
at org.influxdb.impl.InfluxDBImpl.write( ~[influxdb-java-2.4.jar:na]
at org.influxdb.impl.InfluxDBImpl.write( ~[influxdb-java-2.4.jar:na]
at ~[trade-process-service-1.0.0-SNAPSHOT.jar:na]
at ~[trade-process-service-1.0.0-SNAPSHOT.jar:na]
at [trade-process-service-1.0.0-SNAPSHOT.jar:na]
at$init$0( [trade-process-service-1.0.0-SNAPSHOT.jar:na]
at$$Lambda$8/1829287142.process(Unknown Source) [trade-process-service-1.0.0-SNAPSHOT.jar:na]

Google搜索了下,这是InfluxDB v1.1.0 [2016-11-14]版本新加的一个特性(

max-values-per-tag was added with a default of 100,000, but can be disabled by setting it to 0. Existing measurements with tags that exceed this limit will continue to load, but writes that would cause the tags cardinality to increase will be dropped and a partial write error will be returned to the caller. This limit can be used to prevent high cardinality tag values from being written to a measurement.


关于series cardinality:
The number of unique database, measurement, and tag set combinations in an InfluxDB instance.

issue-7146:Add option max-tags-per-database to limit high cardinality data

Much as max-series-per-database in #7095, add a max-tags-per-database to limit high cardinality data.

Writes beyond that should be dropped and logged with a rate limit on the log (one summary log per minute or something saying x writes dropped).

This is important because if you accidentally load in a huge amount of high cardinality data, you can easily get into a place that InfluxDB will OOM if you attempt to delete the data, so your only choice is to try to move the files on disk out the way which deletes other data.

Configuration setting for managing series cardinality

Limiting your series cardinality is an essential part of working with InfluxDB. The new max-values-per-tag configuration setting can help you do just that.

The setting limits the number of tag values allowed per tag key. The default setting is 10,000 (so 10,000 tag values allowed per tag key). If a write causes the number of tag values for a tag key to exceed 10,000, InfluxDB will not write the point and it returns a partial write error.


为什么我们需要关注series cardility?
原因是InfluxDB在内存中维护了系统中每个series数据的索引。随着具有唯一性的series数据数量的增长,RAM的使用也会增长。过高的series cardinality会导致操作系统kill掉InfluxDB进程,抛出OOM异常。

InfluxDB maintains an in-memory index of every series in the system. As the number of unique series grows, so does the RAM usage. High series cardinality can lead to the operating system killing the InfluxDB process with an out of memory (OOM) exception. See Querying for series cardinality to learn how to query for series cardinality.


本文首发于江南烟雨的个人博客博客( ),版权所有,侵权必究。