无法使用cassandra计数器列与cassandra gem [英] Unable to use cassandra counter column with cassandra gem
问题描述
我使用cqlsh通过以下命令创建了一个列系列:
I have created a column family by following command using cqlsh:
create table mystats (key PRIMARY KEY, count counter);
现在从cqlsh我可以增加计数器列,但是当我试图这样做从cassandra gem,as adviced at:
有没有任何Ruby客户端Cassandra与计数器和超列?
Now from the cqlsh I am able to increase the counter column but when I attempt to do this from cassandra gem, as adviced at: Are there any Ruby clients for Cassandra with counters and supercolumn?
所以当我使用:
@stats.add(:mystats, 'randomkey', 1, 'count')
我得到一个错误:
Cassandra :: AccessError在/ client无效列族mystats
Cassandra::AccessError at /client Invalid column family "mystats"
当我进一步查看它时,我发现错误是从gem中提出的:
在文件中: https://github.com/twitter/cassandra/blob/master/lib/cassandra/ columns.rb
When I further looked into it, I found that the error is raised from the gem: in file: https://github.com/twitter/cassandra/blob/master/lib/cassandra/columns.rb
def column_family_property(column_family, key)
cfdef = schema.cf_defs.find {|cfdef| cfdef.name == column_family }
unless cfdef
raise AccessError, "Invalid column family \"#{column_family}\""
end
cfdef.send(key)
end
任何人都可以指出我在这里可能犯的错误。 p>
Can anyone please point out what I might be doing wrong here..
推荐答案
该客户端尚未更新以支持CQL3。我不知道有CQL3的Ruby客户端,所以你最好的选择是创建一个Thrift兼容表(TLDR add WITH COMPACT STORAGE
到你的表定义) 。
That client has not yet been updated to support CQL3. I'm not aware of a CQL3-aware Ruby client, so your best bet is probably to create a Thrift-compatible table (TLDR add WITH COMPACT STORAGE
to your table definition).
这篇关于无法使用cassandra计数器列与cassandra gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!