Cassandra Insertion Error

2019-06-28 00:05发布

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

2条回答
贼婆χ
2楼-- · 2019-06-28 00:43

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

查看更多
Deceive 欺骗
3楼-- · 2019-06-28 01:05

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

查看更多
登录 后发表回答