Cassandra Insertion Error

坚强是说给别人听的谎言 提交于 2019-12-10 17:11:25

问题


I have a 4 Node Cassandra cluster with 2 Cassandra nodes and 2 brisk nodes[cassandra+TT]. Brisk beta 2

I used cassandra-cli to insert create and update column families

My insertions and projections are are always getting failed. For example

Counter Column family

[default@StatsKeySpace] create column family Impressions with comparator=UTF8Type and default_validation_class=CounterColumnType and key_validation_class=UTF8Type;
175d69d0-eb6f-11e0-0000-93bbb4d362fc
Waiting for schema agreement...
... schemas agree across the cluster
[default@StatsKeySpace] incr Impressions['Test']['impressions'] by 10;
null
[default@StatsKeySpace] incr Impressions['Test']['impressions'] by 1; 
null
[default@StatsKeySpace] get Impressions['Test']['impressions'];
null
[default@StatsKeySpace] list Impressions;
Using default limit of 100
null

Standard Column family

[default@StatsKeySpace] set TestColumnFamily['Test']['tamil']='hai';
null

All the nodes are alive in the cluster

This is my keyspace defn

Keyspace: StatsKeySpace:
  Replication Strategy: org.apache.cassandra.locator.NetworkTopologyStrategy
  Durable Writes: true
    Options: [replication_factor:1]

I tried cassandra-cli with debug mode I found this error

[default@unknown] use StatsKeySpace;
Authenticated to keyspace: StatsKeySpace
[default@StatsKeySpace] incr Impressions['tamil']['count'] by 1;
null
java.lang.RuntimeException
    at org.apache.cassandra.cli.CliClient.executeCLIStatement(CliClient.java:297)
    at org.apache.cassandra.cli.CliMain.processStatement(CliMain.java:217)
    at org.apache.cassandra.cli.CliMain.main(CliMain.java:345)

Both the column families has replicate_on_write false Thanks for help in advance

Regards, Tamil


回答1:


Thanks to jbellis, I upgraded the cassandra version being shipped with brisk and ran cassandra-cli with debug mode set. As jbellis mentioned I got a meaningful exception.

UnavailableException - Not enough nodes alive for replication factor to be satisfied.

Since brisk uses brisksnitch which deploys brisk nodes and cassandra nodes across different DCs. One of my 4 nodes cluster which is the seed for Brisk DC was down. I hope that is why I was getting that exception.

So, I restarted my entire cluster with all nodes upgraded with 0.8.6 and keyspace with simplestrategy since, my deployment need to have only one datacenter.

Now all my insertions and projections are doing fine :) Hope brisk b2 is compatible with 0.8.6 in all aspects

Regards, Tamil.s




回答2:


You are trying to increment non-counter columns. See http://www.datastax.com/dev/blog/whats-new-in-cassandra-0-8-part-2-counters for an example of creating a CF for use with counters.

(Brisk b2 ships with what is at this point a fairly old version of Cassandra. I believe newer versions will give back a more helpful error message.)



来源:https://stackoverflow.com/questions/7612394/cassandra-insertion-error

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