View RSS Feed

Recent Blogs Posts

  1. Cassandra Index generator

    by , 02-23-2012 at 06:23 PM
    In this section, we will create a Cassandra index. The below code explains and simulated a simple indexer. In this index, few components are added. In this code, we read text files as resources for this index generator. After reading content into memory, we pass it to tokenizer. This tokenizer is used to remove all none alpha numeric characters using regular expressions. After this it will separate text files using spaces as delimiter. Finally it chooses randomly words which will be used as tags. ...
  2. Cassandra Delete Operation

    by , 02-23-2012 at 06:21 PM
    In this section, we will discuss that how we can delete a value from Cassandra database using Java code.
    Java Code: This is the code to explain Cassandra Delete Operation
    import org.apache.cassandra.thrift.Deletion;
    long timestamp =System.currentTimeMillis();
    List columns = new ArrayList();
    SlicePredicate slicePredicate = new SlicePredicate();
    Deletion deletion = new Deletion(timestamp);
  3. Cassandra Update Operation

    by , 02-23-2012 at 06:19 PM
    To update data in the Cassandra database, batch_update method is used to perform this action. In the below code, we want to update the email address in the database.
    Java Code: This is the code to explain Cassandra Update Operation
    long timestamp = System.currentTimeMillis();
    Column column = new Column("email".getBytes("utf-8"), "".getBytes("utf-8"), timestamp);
    ColumnOrSuperColumn columnOrSuperColumn = new ColumnOrSuperColumn();
  4. Cassandra Read Operation

    by , 02-23-2012 at 06:17 PM
    For example we have a number of authors in the database and we want to read them in Java. Below code explains this operation in detail.
    Java Code: This is the code to Cassandra Read Operation
    import org.apache.cassandra.thrift.SlicePredicate;
    import org.apache.cassandra.thrift.SliceRange;
    import org.apache.cassandra.thrift.ColumnOrSuperColumn;
    import org.apache.cassandra.thrift.ColumnParent;
    import org.apache.cassandra.thrift.ConsistencyLevel;
    SlicePredicate slicePredicate = new SlicePredicate();
  5. Cassandra Add Operation

    by , 02-23-2012 at 06:15 PM
    Following code explains add operation in java.
    Java Code: This is the code to explain Cassandra Add Operation
    Map<String, List<ColumnOrSuperColumn>> data = new HashMap<String, List<ColumnOrSuperColumn>>();        
    List<ColumnOrSuperColumn> columns = new ArrayList<ColumnOrSuperColumn>();
    // Create the email column.
    ColumnOrSuperColumn c = new ColumnOrSuperColumn();
    c.setColumn(new Column("email".getBytes("utf-8"), "ronald (at)".getBytes("utf-8"),
  6. Cassandra Search Indexes

    by , 02-23-2012 at 06:10 PM
    We can perform full text search in some application by reading whole content of the document and searching for the required data in document at acceptable speed. This operation is performed every time a query is executed. This approach is not feasible and recommended in cases where a huge amount of data is used for searching. Also almost no one is using this approach to search documents or database.
    With increasing amount of data on the internet, we need to search millions or sometime billions ...
  7. Making Cassandra Database Connection

    by , 02-23-2012 at 06:06 PM
    First thing to do is to create connection to database. For this purpose, on port 9160 open up a connection that would be a default port of Cassandra. Hand over it to the client of Cassandra and he will be taking care to communication to the server:
    Java Code: This is the code to explain Cassandra Database Connection
    import org.apache.thrift.protocol.TBinaryProtocol;
    import org.apache.thrift.protocol.TProtocol;
    import org.apache.thrift.transport.TSocket;
    import org.apache.thrift.transport.TTransport;
    import org.apache.cassandra.thrift.Cassandra;
  8. Cassandra Keyspaces

    by , 02-23-2012 at 06:02 PM
    Keyspaces are very simple. From RDBMS view point, you may make a comparison to your schema. Normally, you just have 1/application. ColumnFamily are present in a key space. However, it shall be noticed that no relationship exists b/w ColumnFamily as they are separate containers. Than, comes the turn of different containers sorting mechanism. This clearly lets you know that in Cassandra, how data model works.
  9. Cassandra SuperColumn Family

    by , 02-23-2012 at 06:00 PM
    Finally, largest container the SuperColumnFamily is here. If ColumnFamily is understandable by you then such construction is not at all harder. Despite of Column, in inner most Map, consider SuperColumns. This will surely make an extra dimension addition.Key of the Map (that consists of SuperColumn) shall be similar as that of name of the SuperColumn.
    Java Code: This is the code to explain Cassandra SuperColumn Family
    public class SuperColumnFamily {
      Byte[] name;
      // The key is a user generated key
  10. Cassandra Column Family

    by , 02-23-2012 at 05:58 PM
    ColumnFamily is considered as a structure which is responsible for keeping infinite rows for people who have RDBMS background. This structure has much resemblance with a Table. You may have an idea that ColumnFamily consists of a name that is compared to Table name. A map with a value(that is a map consisting of Columns) and a key (that is comparable to the identifier of rows). Map and SuperColumn have similar rules and key consists of similar value of name of the Column.

    Java Code: This is the code to explain Cassandra Column Family

    Updated 02-23-2012 at 06:01 PM by Cassandra

  11. Cassandra alternatives

    by , 02-21-2012 at 08:12 PM
    Before taking any start along with Cassandra, it is important to be well aware of the fact that many alternatives exists for complimenting the relational database. E.g., memcached has been made to be used for, and is free of cost. If you apply such solution to some larger Mysql database alone, you may expect a great performance boost of 100 times.

    Other than this, another famous Nosql solution that has been well renowned is MongoDB, which has been written in language ...
    Tags: cassandra Add / Edit Tags
  12. Why Use Cassandra?

    by , 02-21-2012 at 08:09 PM
    Why Cassandra shall be chosen against any other NoSQL solution?

    • Main selling point of Cassandra is that it is being written in Java.
    • Cassandra has been present on the largest website of the world i.e. Face book.
    • Cassandra has met all the requirements to be decentralized and it doesn’t have one single failure point.
    • Read as well write throughput have been seen to increase in linear fashion, when newer machines get added without any sort of downtime or interruption.
    • It gets
    Tags: cassandra Add / Edit Tags
  13. What is Cassandra?

    by , 02-21-2012 at 08:06 PM
    The Apache Cassandra Project is involved in creating the highly scalable database that is second generation distributed. It brings the Bigtable’s ColumnFamily (based data model) & fully distributed design of Dynamo, together.

    Apache Cassandra is basically an open source that is a highly available database and distributed. Architecture of Apache Cassandra incorporates the design, from Dynamo project. It makes use of data model that is Google’s Bigtable data model based.
    Tags: cassandra Add / Edit Tags