2016-01-11 55 views
0

下邊是我們的表的說明:爲什麼超時發生超時我查詢我的Cassandra數據庫?

、CREATE KEYSPACE statistics 
WITH replication = { 
'class' : 'SimpleStrategy', 
'replication_factor' : 2 
}; 



DROP TABLE IF EXISTS statistics; 

CREATE TABLE statistics (
source text, 
timespan text, 
id text, 
title text, 
thumbnail text, 
url text, 
text text, 
created_at timestamp, 
category text, 
category2 text, 
genre text, 
author text, 
reads int, 
likes int, 
comments int, 
shares int, 
speed int, 
PRIMARY KEY (source, timespan, id) 
)WITH CLUSTERING ORDER BY (timespan DESC) AND caching = '{"keys":"ALL", "rows_per_partition":"ALL"}'; 

通過Stratio的卡桑德拉Lucene索引(https://github.com/Stratio/cassandra-lucene-index

CREATE CUSTOM INDEX statistics_index ON statistics (text) 
USING 'com.stratio.cassandra.lucene.Index' 
WITH OPTIONS = { 
'refresh_seconds' : '10', 
    'schema' : '{ 
     fields : { 
      title : {type : "text", analyzer : "english"}, 
    category : {type:"string"}, 
    category2 : {type:"string"}, 
    genre : {type:"string"}, 
    speed : {type : "integer",sorted : true} 
     } 
    }' 
}; 

創建索引時前端顯示查詢,使用PHP中,卡桑德拉數據庫此錯誤消息發生:

{"message":"Unavailable exception. Error data: array (\n 'consistency' => 2573153,\n 'node' => 1852731252,\n 'replica' => 543253352,\n)","data":{"source":"weibohao","timespan":"1","category":"","genre":"","sort":"speed","sql":"SELECT * FROM statistics WHERE source = 'weibohao' AND timespan = '1' AND text = '{ sort: {fields: [{field: \"speed\", reverse: true}]}}' limit 100"}} 

感謝您的回覆!

回答

3

「不可用的異常」與超時不同。這意味着沒有足夠的副本來滿足您所需的一致性級別。

您擁有兩個複製因子,因此如果您執行的任何操作超過ONE的一致性級別,它將需要兩個副本在查詢時啓動,否則您將收到此消息。

+0

爲什麼沒有足夠的副本以及如何檢查可用的副本? – peter

+1

''''nodetool status'''很好的地方檢查。 –

相關問題