Fluent Cassandra: What does "Apache.Cassandra.UnavailableException" mean?

2.1k Views Asked by At

I am using Cassandra 1.0.5 + newest Fluent Cassandra for my C# application.

I followed the example (with a bit my own modification) in Fluent Cassandra site, but I got an exception called "Apache.Cassandra.UnavailableException".

I am a Cassandra newbie, just want to have a quick simple run on it to get a feeling. So could Any please tell me why?

My simple code is like this:

public class CassandraAPI
{
   private CassandraContext cassandraDB;
   private CassandraColumnFamily<BytesType> family;
   public CassandraAPI()
   {
      cassandraDB = new CassandraContext(keyspace: "MyKeyspace", host: "192.168.178.32");
      family = cassandraDB.GetColumnFamily<BytesType>("ColumnFamilyName");
   }

   public void update(byte[] key1, byte[] value)
   {
      dynamic post = family.CreateRecord(key: key1);
      post.value = value;
      // attach the post to the database
      Console.WriteLine("attaching record");
      cassandraDB.Attach(post);

      // save the changes
      Console.WriteLine("saving changes");
      cassandraDB.SaveChanges();
   }

   public void read(byte[] key)
   {
     dynamic getPost = family.Get(key).FirstOrDefault();
     Console.WriteLine("getPost");
     byte[] value = getPost.value;
     Console.WriteLine(value.Length);
   }
}
1

There are 1 best solutions below

1
On BEST ANSWER

UnavailableException means that you were requesting a ConsistencyLevel that could not be satisfied. For details see:

http://wiki.apache.org/cassandra/API#Exceptions

How big is the cluster to which you are making requests? This would be an unusual error on a local single instance cluster.