incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kamal Bahadur <mailtoka...@gmail.com>
Subject Consistency Level
Date Wed, 28 Dec 2011 22:05:53 GMT
Hi All,

My Cassandra cluster has 4 nodes with a RF of 2. I am trying to verify if
my data gets replicated to 2 nodes with the write consistency level of ONE.
All the tests that I have done so far tells me that the data is not getting
replicated for some reason.

I executed the getendpoints command to find out the node where my record
lives and tried to keep those two nodes running and brought down other
nodes down. When I tried to read the record using hector, I am getting this
exception "May not be enough replicas present to handle consistency level"

I tried to read data using cassandra-cli but I am getting "null".

I ran a manual repair command, but still getting the same exception. I
noticed that as soon as the number of active nodes becomes less than 3 I
get this exception.

With consistency level ONE, I would assume that with just one node up and
running (of course the one that has the data) I should get my data back.
But this is not happening.

Will the read repair happen automatically even if I read and write using
the consistency level ONE?

Any help will be much appreciated.

Thanks,
Kamal

Environment details:

Cluster: *4 nodes*
RF: *2*
Hector: *1.0-1*
Cassandra: *0.8.6*
Read CL: *ONE*
Write CL: *ONE*

Output of describe keyspace:

Keyspace: MyKF:
  Replication Strategy: org.apache.cassandra.locator.SimpleStrategy
  Durable Writes: true
    Options: [replication_factor:2]
  Column Families:
    ColumnFamily: MyCF
      Key Validation Class: org.apache.cassandra.db.marshal.BytesType
      Default column value validator:
org.apache.cassandra.db.marshal.BytesType
      Columns sorted by: org.apache.cassandra.db.marshal.UTF8Type
      Row cache size / save period in seconds: 0.0/0
      Key cache size / save period in seconds: 200000.0/14400
      Memtable thresholds: 0.5812499999999999/1440/124 (millions of
ops/minutes/MB)
      GC grace seconds: 864000
      Compaction min/max thresholds: 4/32
      Read repair chance: 1.0
      Replicate on write: true
      Built indexes: [MyCF.MyCF_appId_idx, MyCF.MyCF_bcId_idx]
      Column Metadata:
        Column Name: .appId
          Validation Class: org.apache.cassandra.db.marshal.UTF8Type
          Index Name: MyCF_appId_idx
          Index Type: KEYS
        Column Name: .bcId
          Validation Class: org.apache.cassandra.db.marshal.UTF8Type
          Index Name: MyCF_bcId_idx
          Index Type: KEYS

My hector code:

public class MyHectorTemplate extends HectorTemplateImpl { public void init
() { CassandraHostConfigurator cassandraHostConfigurator = new
CassandraHostConfigurator( servers); cassandraHostConfigurator .
setLoadBalancingPolicy(new LeastActiveBalancingPolicy()); ThriftCluster
cluster = new ThriftCluster( configuration.getString(
"cassandra_cluster_name"), cassandraHostConfigurator); setCluster(cluster);
setKeyspaceName(configuration.getString("cassandra_keyspace_name"));
ConfigurableConsistencyLevel configurableConsistencyLevelPolicy = new
ConfigurableConsistencyLevel(); configurableConsistencyLevelPolicy .
setDefaultReadConsistencyLevel(HConsistencyLevel.ONE);
setConfigurableConsistencyLevelPolicy(configurableConsistencyLevelPolicy);
super.init(); logger.info("------------------------------------------->" +
getConfigurableConsistencyLevelPolicy().get( OperationType.READ).toString
()); } } Here is the log on one of the nodes: DEBUG [pool-2-thread-2] 2011-
12-28 09:33:47,631 ClientState.java (line 87) logged in: #<User allow_all
groups=[]> DEBUG [pool-2-thread-2] 2011-12-28 09:33:47,651 CassandraServer.
java (line 670) scan DEBUG [pool-2-thread-2] 2011-12-28 09:33:47,665
StorageProxy.java (line 889) restricted ranges for query [-1,-1] are [[-1,0
], (0,42535295865117307932921825928971026432], (
42535295865117307932921825928971026432,
85070591730234615865843651857942052864], (
85070591730234615865843651857942052864,
127605887595351923798765477786913079296], (
127605887595351923798765477786913079296,-1]] DEBUG [pool-2-thread-2] 2011-12
-28 09:33:47,666 StorageProxy.java (line 976) scan ranges are [-1,0],(0,
42535295865117307932921825928971026432],(
42535295865117307932921825928971026432,
85070591730234615865843651857942052864],(
85070591730234615865843651857942052864,
127605887595351923798765477786913079296],(
127605887595351923798765477786913079296,-1] DEBUG [pool-2-thread-2] 2011-12-
28 09:33:47,679 ReadCallback.java (line 76) Blockfor/repair is 1/false;
setting up requests to DEBUG [pool-2-thread-2] 2011-12-28 09:33:47,679
ReadCallback.java (line 203) Live nodes do not satisfy ConsistencyLevel (1
required)

Mime
View raw message