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"}}
感謝您的回覆!
爲什麼沒有足夠的副本以及如何檢查可用的副本? – peter
''''nodetool status'''很好的地方檢查。 –