Unable to use cassandra counter column with cassandra gem

时间秒杀一切 提交于 2020-01-15 10:10:50

问题


I have created a column family by following command using cqlsh:

create table mystats (key PRIMARY KEY, count counter);

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?

So when I use:

@stats.add(:mystats, 'randomkey', 1, 'count')

I get an error:

Cassandra::AccessError at /client Invalid column family "mystats"

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

Can anyone please point out what I might be doing wrong here..


回答1:


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).



来源:https://stackoverflow.com/questions/16396542/unable-to-use-cassandra-counter-column-with-cassandra-gem

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!