Cassandra Concepts: Difference between revisions
(→CQL) |
|||
(13 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
=Overview= | =Overview= | ||
Cassandra is a key-value database. | Cassandra is NoSQL a key-value database. It provides continuous availability with no single point of failure. The database uses a ring design and consistent hashing. In a ring design there is no master node, all nodes are identical and communicate with each other as peers. This architecture allows it to scale horizontally, by incrementally adding nodes with no reconfiguration. Provides good performance for large amounts of data. | ||
=CQL= | =CQL= | ||
Line 12: | Line 12: | ||
SELECT "email" FROM "user_tweets" WHERE "username" = 'john'; | SELECT "email" FROM "user_tweets" WHERE "username" = 'john'; | ||
= | =Cluster= | ||
A cluster is a set of nodes (or <font color=darkgray>data centers</font>) deployed in a ring architecture. A cluster has a name, which will be used by participating nodes. | |||
=Node= | |||
=Keyspace= | =Keyspace= | ||
<span id='Schema'></span>The equivalent of a '''schema''' of relational database. The keyspace is the outermost container for data. A keyspace is characterized by its [[#Replication_Factor|replication factor]], [[#Replica_Placement_Strategy|replica placement strategy]] and its [[#Column_Family|column families]]. | |||
==Replication Factor== | |||
==Replica Placement Strategy== | |||
===Simple Strategy=== | |||
==Keyspace Operations== | ==Keyspace Operations== | ||
Line 20: | Line 31: | ||
* [[Cassandra_Operations#Keyspace_Operations|Describe a Keyspace]] | * [[Cassandra_Operations#Keyspace_Operations|Describe a Keyspace]] | ||
=Table= | =Column Family= | ||
<span id='Table'></span>A column family is the equivalent of a '''table''' in a relational database. Each column family (table) contains a collection of [[#Row|rows]], arranged logically in a map with the following structure: | |||
Map<[[#Row_Key|RowKey]], SortedMap<[[#Column_Key|ColumnKey]], [[#Column_Value|ColumnValue]]>> | |||
==Partition Key== | |||
==Primary Key== | |||
==Row== | |||
=Row= | ==Row Key== | ||
=Column= | ==Column== | ||
= | A column is a data structure that contains a [[#Column_Name|column name]], a [[#Column_Value|value]] and a [[#Column_Timestamp|timestamp]]. | ||
===Column Key=== | |||
===Column Name=== | |||
===Column Value=== | |||
===Column Timestamp=== | |||
=Java Support= | |||
{{External|https://www.baeldung.com/cassandra-with-java}} |
Latest revision as of 21:07, 25 September 2019
Internal
Overview
Cassandra is NoSQL a key-value database. It provides continuous availability with no single point of failure. The database uses a ring design and consistent hashing. In a ring design there is no master node, all nodes are identical and communicate with each other as peers. This architecture allows it to scale horizontally, by incrementally adding nodes with no reconfiguration. Provides good performance for large amounts of data.
CQL
Cassandra Query Language
SELECT "email" FROM "user_tweets" WHERE "username" = 'john';
Cluster
A cluster is a set of nodes (or data centers) deployed in a ring architecture. A cluster has a name, which will be used by participating nodes.
Node
Keyspace
The equivalent of a schema of relational database. The keyspace is the outermost container for data. A keyspace is characterized by its replication factor, replica placement strategy and its column families.
Replication Factor
Replica Placement Strategy
Simple Strategy
Keyspace Operations
Column Family
A column family is the equivalent of a table in a relational database. Each column family (table) contains a collection of rows, arranged logically in a map with the following structure:
Map<RowKey, SortedMap<ColumnKey, ColumnValue>>
Partition Key
Primary Key
Row
Row Key
Column
A column is a data structure that contains a column name, a value and a timestamp.