1) Explain. What is Cassandra?
Cassandra is an open source data storage system. It was developed at Facebook for inbox search and designed for storing and managing large amount of data.
2) What is the use of Cassandra & Why to use Cassandra?
Cassandra is used to handle big data workloads across multiple nodes without any single point failure.
There are some various features of Cassandra:
- It is fault tolerant and consistent
- It is a column-oriented database
- Flexible schema design. etc.
3) What is composite type in Cassandra?
In Cassandra, Composite type is used to express the key or column name with the help of concatenation of data in different type. There are two ways to manipulate the data that are given below:
4) How Cassandra stores data?
Writing data involves some important steps that are listed below.
- Logging data in the commit log
- Writing data to the memtable
- Flushing data from the memtable
- Storing data on disk in SSTables
5) What are the components of Cassandra Data Model?
There are various components of Cassandra data model that are given below:
- Cluster
- Keyspace
- Column
- Column & Family
6) Explain what is a column family in Cassandra?
In Cassandra, column family is referred as a collection of rows.
7) What are the other components of Cassandra?
There are some other following components of Cassandra:
- Node
- Data Center
- Cluster
- Commit log etc.
8) How to write Cassandra data?
We can write the Cassandra data with the help of three components that are given below:
- Commitlog Write
- Memtable Write
- SStable Write
9) What is mandatory while creating a table in Cassandra?
In Cassandra Primary key is Mandatory while creating table. It is made up one or more columns of table.
10) What are Cassandra-CQL collections?
Cassandra-CQL collections help to store multiple values in a single variable that are table formed.
Type |
Description |
List |
It maintain the order of data when needed value store multiple times. |
Set |
It store data in the form of group element. |
Map |
It is a data type, which is used to store a key-value pair of element |
11) What is the syntax to create keyspace in Cassandra?
Cassandra use following syntax for creating keyspace that is given below:
CREATE KEYSPACE <identifier > WITH <properties>
12) What are the keyspace in Cassandra?
In Cassandra, keyspace is a namespace that shows replication on nodes. A cluster contains of keyspace per node.
13) Does Cassandra works on windows?
Yes, Cassandra works well on windows. It also works on Linux operating system.
14) Cassandra is written in which language?
Cassandra is written in Java language.
15) What is the different b/w Cassandra and MongoDB?
Criteria |
Mongo DB |
Cassandra |
Data Model |
Document |
Big Table like |
Database scalability |
Read |
Write |
Querying of data |
Multi-indexed |
Using Key or Scan |
16) What ports does Cassandra use?
By default Cassandra use port- 7000 for cluster communication.
17) What are the consistency levels for read operation in Cassandra?
Cassandra provides some consistency levels for read operation these are given below:
Type of Operation |
Description |
ALL |
It is highly consistent. A write must be written to commitlog and memtable on all replica nodes in the cluster |
EACH_QUORUM |
A write must be written to commitlog and memtable on quorum of replica nodes in all data center. |
LOCAL_QUORUM |
A write must be written to commitlog and memtable on its replica nodes in the same center. |
ONE |
A write must be written to commitlog and memtable of at least one replica node. |
TWO, THREE |
Same as One but at least two and three replica nodes respectively. |
LOCAL_ONE |
The Write must be written at least one replica node |
SERIAL |
Linearizable Consistency to prevent unconditional update. |
LOCAL_SERIAL |
Same as Serial but restricted to local data center. |
18) What is Thrift?
Thrift is the name of the RPC (Remote Procedure Call) client that is used to communicate with the Cassandra serve. In other words, thrift is a legacy RPC protocol or API unified with a code generation tool for CQL. It facilitates to access the Database across the Programming language.
19) Explain Tombstone in Cassandra?
In Cassandra, tombstone is used to create row maker indicating a column deletion. It marks that columns are deleted during compaction.
20) What is CQL?
CQL is Cassandra Query language, which is used to access query the Apache distributed database. The syntax of CQL is similar to SQL but it does not alter the Cassandra data model.
21) Explain what is Cassandra-Cqlsh?
Cassandra Cqlsh is a query language that helps users to communicate with Database. It allows us to do the following things:
- Define a schema
- Insert a data
- Execute a query
22) What do you mean by Kundera?
Kundera is an Object Mapper library that is used with the NoSql databases. It is written in java and can used in Cassandra, MongoDB etc.
23) Mention what need to be take care while adding a column in Cassandra?
While adding a column you need to take care the following points:
- Column is not conflicting with the existing column names.
- Table is not defined with compact storage option.
24) What is Replication Factor in Cassandra?
Replication Factor is used to measure the number of data existing copied data. It is important to increase the replication factor to log into the cluster.
25) What is the use of truncate command?
Truncate command is used to delete all the rows of the table permanently.
Syntax:
26) What are the various shell commands?
There are various shell commands that are given below:
Shell Commands |
Description |
Help |
It is used to displays a synopsis and a brief description. |
Capture |
It is used to captures the output of a command and adds it to a file. |
Consistency |
It is used to shows the current consistency level. |
Copy |
This command is used to copy the data. |
Describe |
This command is used to describe the current cluster of Cassandra and its objects. |
27) What are the CQL users-define data types?
There are following CQL user define data types:
- CREATE TYPE: It is used to create a user-defined datatype.
- ALTER TYPE: It is used to modify a user-defined datatype.
- DROP TYPE: It is used to drop a user-defined datatype.
- DESCRIBE TYPE: It is used to describe a user-defined datatype.
- DESCRIBE TYPES: It is used to describe user-defined datatypes.
28) What is the syntax to create trigger?
The following is the syntax for create trigger:
create_trigger_statement ::= CREATE TRIGGER [ IF NOT EXISTS ] trigger_name
ON table_name
USING string
29) What are the types of CQL functions?
There are two types of CQL functions that are given below:
- scalar functions: scalar function take a number of values and produce an output with it.
- aggregate functions : aggregate functions are used to aggregate multiple rows results from a SELECT statement.
30) Does Cassandra support JSON?
Yes, Cassandra supports JSON.