本文介紹常見的TSDB For InfluxDB®錯誤資訊和關於它們的描述,以及常見的解決方案。
如何處理報錯“database name required”?
當包含SHOW的查詢沒有明確指定一個資料庫時,錯誤database name required就會發生。指定資料庫的方法包括:在SHOW查詢中使用ON子句,在CLI中使用USE <database_name>,或者在HTTP API請求中使用參數db。
相關的SHOW查詢包括SHOW RETENTION POLICIES、SHOW SERIES、SHOW MEASUREMENTS、SHOW TAG KEYS、SHOW TAG VALUES和SHOW FIELD KEYS。
如何處理報錯“max series per database exceeded: < >”?
當寫入導致資料庫中序列的數量超過每個資料庫允許的最大序列數量時,錯誤max series per database exceeded就會發生。每個資料庫允許的最大序列數量由購買的執行個體規格所決定。
< >內的資訊展示了那些超出max-series-per-database限制的序列的measurement和tag set。
如何處理報錯“found < >, expected identifier at line < >, char < >”?
InfluxQL文法
當TSDB For InfluxDB®在查詢中找不到預期的標識符時,錯誤
expected identifier就會發生。標識符是連續查詢名字、資料庫名字、field key、measurement的名字、保留原則名字、subscription的名字、tag key和使用者名稱。這個錯誤通常用於提醒您仔細檢查您的查詢文法。樣本:
> SELECT * FROM WHERE "blue"= true ERR: error parsing query: found WHERE, expected identifier at line 1, char 15該查詢在
FROM和WHERE之間缺少measurement的名字。InfluxQL關鍵字
在某些情況下,當查詢中某個標識符是InfluxQL關鍵字時,錯誤
expected identifier就會發生。如果要查詢也是InfluxQL關鍵字的標識符,請用雙引號將標識符括起來。在某些情況下,當查詢中某個標識符是InfluxQL關鍵字時,錯誤
expected identifier就會發生。如果要查詢也是InfluxQL關鍵字的標識符,請用雙引號將標識符括起來。樣本
> SELECT duration FROM runs ERR: error parsing query: found DURATION, expected identifier, string, number, bool at line 1, char 8在查詢中,field key
duration是一個InfluxQL關鍵字。為了避免錯誤,請用雙引號將duration括起來:> SELECT "duration" FROM runs
如何處理報錯“found < >, expected string at line < >, char < >”?
當TSDB For InfluxDB®在查詢中找不到預期的字串時,錯誤expected string就會發生。
如何處理報錯“mixing aggregate and non-aggregate queries is not supported”?
當SELECT語句同時包含彙總函式和不使用彙總函式的field key或tag key時,錯誤mixing aggregate and non-aggregate就會發生。
彙總函式返回一個計算結果,對於沒有被彙總的field或tag,沒有明顯的單個值可以返回。
樣本
未經處理資料:measurement peg有兩個field(square and round)和一個tag(force):
name: peg
---------
time square round force
2016-10-07T18:50:00Z281
2016-10-07T18:50:10Z4122
2016-10-07T18:50:20Z6144
2016-10-07T18:50:30Z7153查詢一:
> SELECT mean("square"),"round" FROM "peg"
ERR: error parsing query: mixing aggregate and non-aggregate queries is not supported查詢一包含一個彙總函式和一個單獨的field。
mean("square")返回一個彙總值,這是measurement peg中的四個square值的平均值,但是從field round的四個非彙總的field value中,沒有明顯的單個值可以返回。
查詢二:
> SELECT mean("square"),"force" FROM "peg"
ERR: error parsing query: mixing aggregate and non-aggregate queries is not supported查詢二包含一個彙總函式和一個單獨的tag。
mean("square")返回一個彙總值,這是measurement peg中的四個square值的平均值,但是從tag force的四個非彙總的tag value中,沒有明顯的單個值可以返回。
如何處理報錯“time and *influxql.VarRef are not compatible”?
當在查詢中用雙引號把日期時間字串括起來時,錯誤time and \*influxql.VarRef are not compatible就會發生。需要用單引號把日期時間字串括起來。
樣本
用雙引號把日期時間字串括起來:
> SELECT "water_level" FROM "h2o_feet" WHERE "location"='santa_monica' AND time >="2015-08-18T00:00:00Z" AND time <="2015-08-18T00:12:00Z"
ERR: invalid operation: time and *influxql.VarRef are not compatible用單引號把日期時間字串括起來:
> SELECT "water_level" FROM "h2o_feet" WHERE "location"='santa_monica' AND time >='2015-08-18T00:00:00Z' AND time <='2015-08-18T00:12:00Z'
name: h2o_feet
time water_level
---------------
2015-08-18T00:00:00Z2.064
2015-08-18T00:06:00Z2.116
2015-08-18T00:12:00Z2.028如何處理報錯“bad timestamp”?
時間文法
當行協議包含不是UNIX時間戳記格式的時間戳記時,錯誤
bad timestamp就會發生。樣本
> INSERT pineapple value=1'2015-08-18T23:00:00Z' ERR:{"error":"unable to parse 'pineapple value=1 '2015-08-18T23:00:00Z'': bad timestamp"}上面的行協議使用了RFC3339格式的時間戳記。為了避免錯誤,成功將資料點寫入TSDB For InfluxDB®,將時間戳記替換成UNIX時間戳記:
> INSERT pineapple,fresh=true value=11439938800000000000行協議文法
在某些情況下,當行協議中有更通用的語法錯誤時,錯誤
bad timestamp就會發生。樣本
寫入一:
> INSERT hens location=2 value=9 ERR:{"error":"unable to parse 'hens location=2 value=9': bad timestamp"}在寫入一中的行協議使用空格將measurement
hen和taglocation=2分開,而不是用逗號。TSDB For InfluxDB®把fieldvalue=9當成了時間戳記,所以返回錯誤。為了避免錯誤,使用逗號(而不是空格)將measurement和tag分開:
> INSERT hens,location=2 value=9寫入二:
> INSERT cows,name=daisy milk_prod=3 happy=3 ERR:{"error":"unable to parse 'cows,name=daisy milk_prod=3 happy=3': bad timestamp"}在寫入二中的行協議使用空格將field
milk_prod=3和fieldhappy=3分開,而不是用逗號。TSDB For InfluxDB®把fieldhappy=3當成了時間戳記,所以返回錯誤。為了避免錯誤,使用逗號(而不是空格)將兩個field分開:
> INSERT cows,name=daisy milk_prod=3,happy=3
如何處理報錯“time outside range”?
當行協議中的時間戳記在TSDB For InfluxDB®的有效時間範圍之外時,錯誤time outside range就會發生。
最小的有效時間戳記是-9223372036854775806或1677-09-21T00:12:43.145224194Z,最大的有效時間戳記是9223372036854775806或2262-04-11T23:47:16.854775806Z。
如何處理報錯“engine: cache maximum memory size exceeded”?
當寫入速度過快,導致服務端cache大小短時間超過預設的門限時,錯誤cache maximum memory size exceeded就會發生。預設的門限由購買的執行個體規格決定。