二级索引更新问题
我创建了 KS & CF 使用 cassandra-0.7.8 并插入一些行和列值(大约 1000 行)。后来,我想索引 2 列值。所以,我发出了“更新列族..”命令。之后,当我根据索引值查询时,它显示“未找到行”。 索引后 1. 发出 nodetoollush 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}
];
如有任何建议,我们将不胜感激。
I have created KS & CF using cassandra-0.7.8 and inserted some rows and column values(around 1000 rows). Later, I wanted to index 2 column values. So, I issued 'update column family..' command. After, when I query based on indexed value it says "Row does not found".
After indexing 1. Issued nodetool flush 2.restarted Cassandra once. Though it is same. But, I could see some XXX-Index.db file on cassandra data directory.
What am I missing?
Here are CF details,
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}
];
Any suggestions would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果在您已经拥有大量数据之后添加二级索引,则需要一段时间来构建二级索引。这不是同步添加,索引是异步构造的。您可能会考虑等待一段时间,直到索引完成。不幸的是,我不知道确定索引何时完成的好方法。
Secondary indexes take a while to build if they are added after you already have a bunch of data. It's not a synchronous addition, the indexes are constructed asynchronously. You might consider waiting a while until the indexing is done. Unfortunately I don't know a good way to determine when that indexing has completed.