Cassandra is a distributed database from Apache that is highly scalable and designed to manage very large amounts of structured data. It provides high availability with no single point of failure.
Apache Cassandra is a highly scalable, high-performance distributed database designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure. It is a type of NoSQL database. Let us first understand what a NoSQL database does.
Listed below are some of the notable points of Apache Cassandra:
sudo rm -rf /var/lib/cassandra/*
bin/cassandra -f
quit;
show keyspaces;
show api version;
use Twissandra;
create column family User with comparator = UTF8Type;
update column family User with
column_metadata =
[
{column_name: first, validation_class: UTF8Type},
{column_name: last, validation_class: UTF8Type},
{column_name: age, validation_class: UTF8Type, index_type: KEYS}
];
set User['jsmith']['first'] = 'John';
set User['jsmith']['last'] = 'Smith';
set User['jsmith']['age'] = '38';
Apache Cassandra is a highly scalable, high-performance distributed database designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure. It is a type of NoSQL database. Let us first understand what a NoSQL database does.
Listed below are some of the notable points of Apache Cassandra:
- It is scalable, fault-tolerant, and consistent.
- Cassandra is being used by some of the biggest companies such as Facebook, Twitter, Cisco, Rackspace, ebay, Twitter, Netflix, and more.
- It is a column-oriented database.
- Cassandra implements a Dynamo-style replication model with no single point of failure, but adds a more powerful “column family” data model.
- Its distribution design is based on Amazon’s Dynamo and its data model on Google’s Bigtable.
- Created at Facebook, it differs sharply from relational database management systems.
Cassandra Commands and Simple Example
To start Cassandra afresh
sudo rm -rf /var/log/cassandra/*sudo rm -rf /var/lib/cassandra/*
Starting the server
cd $CASSANDRA_HOMEbin/cassandra -f
Starting the CLI
bin/cassandra-cliquit;
Describing the Environment
show cluster name;show keyspaces;
show api version;
DML Operations
A keyspace is similar to the database, a column familiy similar to a table and columns are similar to columns in RDBMS.
create keyspace Twissandra;use Twissandra;
create column family User with comparator = UTF8Type;
update column family User with
column_metadata =
[
{column_name: first, validation_class: UTF8Type},
{column_name: last, validation_class: UTF8Type},
{column_name: age, validation_class: UTF8Type, index_type: KEYS}
];
DDL Operations
To insert data
assume User keys as utf8;set User['jsmith']['first'] = 'John';
set User['jsmith']['last'] = 'Smith';
set User['jsmith']['age'] = '38';
No comments:
Post a Comment