我使用cassandra-0.7.8创建了KS & CF,并插入了一些行和列值(大约1000行)。后来,我想为2个列值建立索引。所以,我发出了“update column family..”命令。之后,当我根据索引值进行查询时,它会显示"Row not found“。在索引1之后。发出nodetool flush 2。重启Cassandra一次。尽管它是一样的。但是,我可以在cassandra数据目录中看到一些XXX-Index.db文件。我遗漏了什么?
以下是CF的详细信息,
create column family ipinfo with column_type=Standard and
default_validation_class = UTF8Type and comparator=UTF8Type and
keys_cached=25000 and rows_cached=5000 and column_metadata=[
{ column_name : country, validation_class : UTF8Type},
{ column_name : ip, validation_class : LongType},
{ column_name : domain, validation_class : UTF8Type },
];
update column family ip with column_type=Standard and
default_validation_class = UTF8Type and comparator=UTF8Type and
keys_cached=25000 and rows_cached=5000 and column_metadata=[
{column_name : country, validation_class : UTF8Type },
{column_name : domain, validation_class : UTF8Type, index_type: KEYS},
{column_name : ip, validation_class : LongType, index_type: KEYS}
];如有任何建议,我们将不胜感激。
发布于 2012-03-29 16:36:58
如果二级索引是在您已经有一堆数据之后添加的,则需要一段时间才能构建它们。这不是同步添加,索引是异步构造的。您可以考虑等待一段时间,直到索引完成。不幸的是,我不知道确定索引何时完成的好方法。
https://stackoverflow.com/questions/7334447
复制相似问题