Getting Started with Apache Cassandra

Datetime:2017-04-18 05:43:03         Topic: Cassandra          Share        Original >>
Here to See The Original Article!!!

Why Apache Cassandra?

Apache Cassandra is a free, open source, distributed data storage system that differs sharply from relational database management systems.

Cassandra has become so popular because of its outstanding technical features. It is durable, seamlessly scalable, and tuneably consistent.

It performs blazingly fast writes, can store hundreds of terabytes of data, and is decentralized and symmetrical so there’s no single point of failure.

It is highly available and offers a schema-free data model.

Installation:

Cassandra is available for download from the Web here . Just click the link on the home page to download the latest release version and Unzip the downloaded cassandra  to a local directory.

Starting the Server:

To start the Cassandra server on any OS, open a command prompt or terminal window, navigate to the /bin where you unpacked Cassandra,

and run the following command to start your server.

In a clean installation, you should see some log statements like this:

$ bin/cassandra -f

Congratulations! Now your Cassandra server should be up and running with a new single node cluster called Test Cluster listening on port 9160.

Running the Command-Line Client Interface:

Now that you have a Cassandra installation up and running, let’s give it a quick try to make sure everything is set up properly

The Cassandra client will start:

$ bin/cqlsh

Creating a Keyspace :

A Cassandra keyspace is sort of like a relational database.

Let’s create our own keyspace so we have something to write data to:

CREATE KEYSPACE <keyspacename> WITH replication = {'class':'<strategyname>', 'replication_factor' : <no_of_replication>};

where replication option is to specify the Replica Placement strategy and the number of replicas wanted. Strategies for replication can be one of the following:

  • Simple Strategy – Specifies a simple replication factor for the cluster.
  • NetworkTopologyStrategy – Specifies how many replicas you want in each data center.

After you have created your own keyspace, you can switch to it in the shell by typing:

$ use keyspacename ;

References:Cassandra Definitive Guide








New