0

as I am new to Cassandra. I want to create a column family using pycassa API. I have created a column family by using the following code:

validators = {'full_name': UTF8_TYPE,
          'email': UTF8_TYPE,
          'state': UTF8_TYPE,
          'gender': UTF8_TYPE,
          'birth_year': LONG_TYPE}

sys.create_column_family('TestKeyspace', 'TestCF', super=False,
          comparator_type=UTF8_TYPE,
          key_validation_class=UTF8_TYPE, 
          column_validation_classes=validators)

The python script is running fine without any exceptions. But when I check this column family using cassandra-cli. I got the follwing exception:

UnavailableException()
        at org.apache.cassandra.thrift.Cassandra$get_range_slices_result$get_range_slices_resultStandardScheme.read(Cassandra.java:17439)
        at org.apache.cassandra.thrift.Cassandra$get_range_slices_result$get_range_slices_resultStandardScheme.read(Cassandra.java:17397)
        at org.apache.cassandra.thrift.Cassandra$get_range_slices_result.read(Cassandra.java:17323)
        at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)
        at org.apache.cassandra.thrift.Cassandra$Client.recv_get_range_slices(Cassandra.java:802)
        at org.apache.cassandra.thrift.Cassandra$Client.get_range_slices(Cassandra.java:786)
        at org.apache.cassandra.cli.CliClient.executeList(CliClient.java:1520)
        at org.apache.cassandra.cli.CliClient.executeCLIStatement(CliClient.java:285)
        at org.apache.cassandra.cli.CliMain.processStatementInteractive(CliMain.java:201)
        at org.apache.cassandra.cli.CliMain.main(CliMain.java:331)

I don't know why I am getting this error. Does anyone have working code for the same. Thanks in advance.

Carl0s1z
  • 4,683
  • 7
  • 32
  • 47
Narendra
  • 3
  • 1

1 Answers1

2

How did you create the Keyspace and what are the replication settings for it? UnavailableException means that there aren't enough live replicas to respond to the query. My guess is that you either accidentally set the replication factor too high, or you're using NetworkTopologyStrategy and the datacenter names in the replication settings don't match the actual datacenter names for your nodes.

Tyler Hobbs
  • 6,872
  • 24
  • 31
  • No, my replication factor is 1 and I am using SIMPLE Strategy. Here is code snippet: `sys.create_keyspace('db5', SIMPLE_STRATEGY, {'replication_factor': '1'})` – Narendra Feb 07 '14 at 04:28
  • Well in that case, do you have more than one node or any down nodes? Run `nodetool status` on each node to see if any of them think another node is down. – Tyler Hobbs Feb 07 '14 at 16:30
  • Yes, I have a three node cluster and the other two nodes were down. So, I cleanup the dead nodes & now I can see the data in cassandra-cli(without any exception) which I have inserted using pycassa API. Thank you very much Sir. Keep up the good work. – Narendra Feb 08 '14 at 17:59