문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top