Apache Cassandra

Last updated
Apache Cassandra
Original author(s) Avinash Lakshman, Prashant Malik / Facebook
Developer(s) Apache Software Foundation
Initial releaseJuly 2008;15 years ago (2008-07)
Stable release
4.1.3 [1]   OOjs UI icon edit-ltr-progressive.svg / 24 July 2023;6 months ago (24 July 2023)
Repository
Written in Java
Operating system Cross-platform
Available inEnglish
Type NoSQL Database, data store
License Apache License 2.0
Website cassandra.apache.org   OOjs UI icon edit-ltr-progressive.svg

Cassandra is a free and open-source, distributed, wide-column store, NoSQL database management system designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure. Cassandra offers support for clusters spanning multiple data centers, [2] with asynchronous masterless replication allowing low latency operations for all clients. Cassandra was designed to implement a combination of Amazon's Dynamo distributed storage and replication techniques combined with Google's Bigtable data and storage engine model. [3]

Contents

History

Avinash Lakshman, one of the authors of Amazon's Dynamo, and Prashant Malik initially developed Cassandra at Facebook to power the Facebook inbox search feature. Facebook released Cassandra as an open-source project on Google code in July 2008. [4] In March 2009, it became an Apache Incubator project. [5] On February 17, 2010, it graduated to a top-level project. [6]

Facebook developers named their database after the Trojan mythological prophet Cassandra, with classical allusions to a curse on an oracle. [7]

Releases

Releases after graduation include

VersionOriginal release dateLatest versionRelease dateStatus [16]
Old version, no longer maintained: 0.62010-04-120.6.132011-04-18No longer maintained
Old version, no longer maintained: 0.72011-01-100.7.102011-10-31No longer maintained
Old version, no longer maintained: 0.82011-06-030.8.102012-02-13No longer maintained
Old version, no longer maintained: 1.02011-10-181.0.122012-10-04No longer maintained
Old version, no longer maintained: 1.12012-04-241.1.122013-05-27No longer maintained
Old version, no longer maintained: 1.22013-01-021.2.192014-09-18No longer maintained
Old version, no longer maintained: 2.02013-09-032.0.172015-09-21No longer maintained
Old version, no longer maintained: 2.12014-09-162.1.222020-08-31No longer maintained
Old version, no longer maintained: 2.22015-07-202.2.192020-11-04No longer maintained
Older version, yet still maintained: 3.02015-11-093.0.292023-05-15Maintained until 5.0.0 release (Nov-Dec 2023)
Older version, yet still maintained: 3.112017-06-233.11.152023-05-05Maintained until 5.0.0 release (Nov-Dec 2023)
Older version, yet still maintained: 4.02021-07-264.0.92023-04-14Maintained until 5.1.0 release (~July 2024)
Current stable version:4.12022-06-174.1.42024-02-14Latest release
Legend:
Old version
Older version, still maintained
Latest version
Latest preview version
Future release

Main features

Distributed
Every node in the cluster has the same role. There is no single point of failure. Data is distributed across the cluster (so each node contains different data), but there is no master as every node can service any request.
Supports replication and multi data center replication
Replication strategies are configurable. [17] Cassandra is designed as a distributed system, for deployment of large numbers of nodes across multiple data centers. Key features of Cassandra’s distributed architecture are specifically tailored for multiple-data center deployment, for redundancy, for failover and disaster recovery.
Scalability
Designed to have read and write throughput both increase linearly as new machines are added, with the aim of no downtime or interruption to applications.
Fault-tolerant
Data is automatically replicated to multiple nodes for fault-tolerance. Replication across multiple data centers is supported. Failed nodes can be replaced with no downtime.
Tunable consistency
Cassandra is typically classified as an AP system, meaning that availability and partition tolerance are generally considered to be more important than consistency in Cassandra, [18] Writes and reads offer a tunable level of consistency, all the way from "writes never fail" to "block for all replicas to be readable", with the quorum level in the middle. [19]
MapReduce support
Cassandra has Hadoop integration, with MapReduce support. There is support also for Apache Pig and Apache Hive. [20]
Query language
Cassandra introduced the Cassandra Query Language (CQL). CQL is a simple interface for accessing Cassandra, as an alternative to the traditional Structured Query Language (SQL).
Eventual consistency
Cassandra manages eventual consistency of reads, upserts and deletes through Tombstones.

Cassandra Query Language

Cassandra introduced the Cassandra Query Language (CQL). CQL is a simple interface for accessing Cassandra, as an alternative to the traditional Structured Query Language (SQL). CQL adds an abstraction layer that hides implementation details of this structure and provides native syntaxes for collections and other common encodings. Language drivers are available for Java (JDBC), Python (DBAPI2), Node.JS (Datastax), Go (gocql) and C++. [21]

The keyspace in Cassandra is a namespace that defines data replication across nodes. Therefore, replication is defined at the keyspace level. Below an example of keyspace creation, including a column family in CQL 3.0: [22]

CREATEKEYSPACEMyKeySpaceWITHREPLICATION={'class':'SimpleStrategy','replication_factor':3};USEMyKeySpace;CREATECOLUMNFAMILYMyColumns(idtext,lastNametext,firstNametext,PRIMARYKEY(id));INSERTINTOMyColumns(id,lastName,firstName)VALUES('1','Doe','John');SELECT*FROMMyColumns;

Which gives:

 id | lastName | firstName ----+----------+----------   1 | Doe      | John  (1 rows) 

Known issues

Up to Cassandra 1.0, Cassandra was not row-level consistent, [23] meaning that inserts and updates into the table that affect the same row that are processed at approximately the same time may affect the non-key columns in inconsistent ways. One update may affect one column while another affects the other, resulting in sets of values within the row that were never specified or intended. Cassandra 1.1 solved this issue by introducing row-level isolation. [24]

Cassandra is not supported on Windows as of version 4, see issue CASSANDRA-16171. [25]

Tombstones

Deletion markers called "Tombstones" are known to cause severe performance degradation. [26]

Data model

Cassandra is wide column store, and, as such, essentially a hybrid between a key-value and a tabular database management system. Its data model is a partitioned row store with tunable consistency. [19] Rows are organized into tables; the first component of a table's primary key is the partition key; within a partition, rows are clustered by the remaining columns of the key. [27] Other columns may be indexed separately from the primary key. [28]

Tables may be created, dropped, and altered at run-time without blocking updates and queries. [29]

Cassandra cannot do joins or subqueries. Rather, Cassandra emphasizes denormalization through features like collections. [30]

A column family (called "table" since CQL 3) resembles a table in an RDBMS (Relational Database Management System). Column families contain rows and columns. Each row is uniquely identified by a row key. Each row has multiple columns, each of which has a name, value, and a timestamp. Unlike a table in an RDBMS, different rows in the same column family do not have to share the same set of columns, and a column may be added to one or multiple rows at any time. [31]

Each key in Cassandra corresponds to a value which is an object. Each key has values as columns, and columns are grouped together into sets called column families. Thus, each key identifies a row of a variable number of elements. These column families could be considered then as tables. A table in Cassandra is a distributed multi dimensional map indexed by a key. Furthermore, applications can specify the sort order of columns within a Super Column or Simple Column family.

Management and monitoring

Cassandra is a Java-based system that can be managed and monitored via Java Management Extensions (JMX). The JMX-compliant nodetool utility, for instance, can be used to manage a Cassandra cluster (adding nodes to a ring, draining nodes, decommissioning nodes, and so on). [32] Nodetool also offers a number of commands to return Cassandra metrics pertaining to disk usage, latency, compaction, garbage collection, and more. [33]

Since Cassandra 2.0.2 in 2013, measures of several metrics are produced via the Dropwizard metrics framework, [34] and may be queried via JMX using tools such as JConsole or passed to external monitoring systems via Dropwizard-compatible reporter plugins. [35]

See also

Related Research Articles

<span class="mw-page-title-main">PostgreSQL</span> Free and open-source object relational database management system

PostgreSQL, also known as Postgres, is a free and open-source relational database management system (RDBMS) emphasizing extensibility and SQL compliance. PostgreSQL features transactions with atomicity, consistency, isolation, durability (ACID) properties, automatically updatable views, materialized views, triggers, foreign keys, and stored procedures. It is supported on all major operating systems, including Linux, FreeBSD, OpenBSD, macOS, and Windows, and handles a range of workloads from single machines to data warehouses or web services with many concurrent users.

MySQL Cluster is a technology providing shared-nothing clustering and auto-sharding for the MySQL database management system. It is designed to provide high availability and high throughput with low latency, while allowing for near linear scalability. MySQL Cluster is implemented through the NDB or NDBCLUSTER storage engine for MySQL.

Multi-master replication is a method of database replication which allows data to be stored by a group of computers, and updated by any member of the group. All members are responsive to client data queries. The multi-master replication system is responsible for propagating the data modifications made by each member to the rest of the group and resolving any conflicts that might arise between concurrent changes made by different members.

SAP IQ is a column-based, petabyte scale, relational database software system used for business intelligence, data warehousing, and data marts. Produced by Sybase Inc., now an SAP company, its primary function is to analyze large amounts of data in a low-cost, highly available environment. SAP IQ is often credited with pioneering the commercialization of column-store technology.

<span class="mw-page-title-main">Apache Solr</span> Open-source enterprise-search platform

Solr is an open-source enterprise-search platform, written in Java. Its major features include full-text search, hit highlighting, faceted search, real-time indexing, dynamic clustering, database integration, NoSQL features and rich document handling. Providing distributed search and index replication, Solr is designed for scalability and fault tolerance. Solr is widely used for enterprise search and analytics use cases and has an active development community and regular releases.

<span class="mw-page-title-main">Apache CouchDB</span> Document-oriented NoSQL database

Apache CouchDB is an open-source document-oriented NoSQL database, implemented in Erlang.

A database shard, or simply a shard, is a horizontal partition of data in a database or search engine. Each shard is held on a separate database server instance, to spread load.

<span class="mw-page-title-main">Apache Hive</span> Database engine

Apache Hive is a data warehouse software project, built on top of Apache Hadoop for providing data query and analysis. Hive gives an SQL-like interface to query data stored in various databases and file systems that integrate with Hadoop. Traditional SQL queries must be implemented in the MapReduce Java API to execute SQL applications and queries over distributed data. Hive provides the necessary SQL abstraction to integrate SQL-like queries into the underlying Java without the need to implement queries in the low-level Java API. Since most data warehousing applications work with SQL-based querying languages, Hive aids the portability of SQL-based applications to Hadoop. While initially developed by Facebook, Apache Hive is used and developed by other companies such as Netflix and the Financial Industry Regulatory Authority (FINRA). Amazon maintains a software fork of Apache Hive included in Amazon Elastic MapReduce on Amazon Web Services.

Hector is a high-level client API for Apache Cassandra. Named after Hector, a warrior of Troy in Greek mythology, it is a substitute for the Cassandra Java Client, or Thrift, that is encapsulated by Hector. It also has Maven repository access.

<span class="mw-page-title-main">Keyspace (distributed data store)</span> Digital object that holds together all column families of a design

A keyspace in a NoSQL data store is an object that holds together all column families of a design. It is the outermost grouping of the data in the data store. It resembles the schema concept in Relational database management systems. Generally, there is one keyspace per application.

<span class="mw-page-title-main">Standard column family</span>

The standard column family is a NoSQL object that contains columns of related data. It is a tuple (pair) that consists of a key–value pair, where the key is mapped to a value that is a set of columns. In analogy with relational databases, a standard column family is as a "table", each key–value pair being a "row". Each column is a tuple consisting of a column name, a value, and a timestamp. In a relational database table, this data would be grouped together within a table with other non-related data.

A tombstone is a deleted record in a replica of a distributed data store. The tombstone is necessary, as distributed data stores use eventual consistency, where only a subset of nodes where the data is stored must respond before an operation is considered to be successful.

Apache Accumulo is a highly scalable sorted, distributed key-value store based on Google's Bigtable. It is a system built on top of Apache Hadoop, Apache ZooKeeper, and Apache Thrift. Written in Java, Accumulo has cell-level access labels and server-side programming mechanisms. According to DB-Engines ranking, Accumulo is the third most popular NoSQL wide column store behind Apache Cassandra and HBase and the 67th most popular database engine of any type (complete) as of 2018.

<span class="mw-page-title-main">Apache Drill</span> Open-source software framework

Apache Drill is an open-source software framework that supports data-intensive distributed applications for interactive analysis of large-scale datasets. Built chiefly by contributions from developers from MapR, Drill is inspired by Google's Dremel system. Drill is an Apache top-level project. Tom Shiran is the founder of the Apache Drill Project. It was designated an Apache Software Foundation top-level project in December 2016.

<span class="mw-page-title-main">Oracle NoSQL Database</span> Distributed database

Oracle NoSQL Database is a NoSQL-type distributed key-value database from Oracle Corporation. It provides transactional semantics for data manipulation, horizontal scalability, and simple administration and monitoring.

FoundationDB is a free and open-source multi-model distributed NoSQL database developed by Apple Inc. with a shared-nothing architecture. The product was designed around a "core" database, with additional features supplied in "layers." The core database exposes an ordered key–value store with transactions. The transactions are able to read or write multiple keys stored on any machine in the cluster while fully supporting ACID properties. Transactions are used to implement a variety of data models via layers.

<span class="mw-page-title-main">Apache Trafodion</span> Relational database management system for Apache Hadoop

Apache Trafodion is an open-source Top-Level Project at the Apache Software Foundation. It was originally developed by the information technology division of Hewlett-Packard Company and HP Labs to provide the SQL query language on Apache HBase targeting big data transactional or operational workloads. The project was named after the Welsh word for transactions. As of April 2021, it is no longer actively developed.

A wide-column store is a column-oriented DBMS and therefore a special type of NoSQL database. It uses tables, rows, and columns, but unlike a relational database, the names and format of the columns can vary from row to row in the same table. A wide-column store can be interpreted as a two-dimensional key–value store. Google's Bigtable is one of the prototypical examples of a wide-column store.

Presto is a distributed query engine for big data using the SQL query language. Its architecture allows users to query data sources such as Hadoop, Cassandra, Kafka, AWS S3, Alluxio, MySQL, MongoDB and Teradata, and allows use of multiple data sources within a query. Presto is community-driven open-source software released under the Apache License.

<span class="mw-page-title-main">Trino (SQL query engine)</span> Open-source distributed SQL query engine

Trino is an open-source distributed SQL query engine designed to query large data sets distributed over one or more heterogeneous data sources. Trino can query data lakes that contain open column-oriented data file formats like ORC or Parquet residing on different storage systems like HDFS, AWS S3, Google Cloud Storage, or Azure Blob Storage using the Hive and Iceberg table formats. Trino also has the ability to run federated queries that query tables in different data sources such as MySQL, PostgreSQL, Cassandra, Kafka, MongoDB and Elasticsearch. Trino is released under the Apache License.

References

  1. Error: Unable to display the reference properly. See the documentation for details.
  2. Casares, Joaquin (2012-11-05). "Multi-datacenter Replication in Cassandra". DataStax. Retrieved 2013-07-25. Cassandra's innate datacenter concepts are important as they allow multiple workloads to be run across multiple datacenters…
  3. "Apache Cassandra Documentation Overview" . Retrieved 2021-01-21.
  4. Hamilton, James (July 12, 2008). "Facebook Releases Cassandra as Open Source" . Retrieved 2009-06-04.
  5. "Is this the new hotness now?". Mail-archive.com. 2009-03-02. Archived from the original on 25 April 2010. Retrieved 2010-03-29.
  6. "Cassandra is an Apache top level project". Mail-archive.com. 2010-02-18. Archived from the original on 28 March 2010. Retrieved 2010-03-29.
  7. "The meaning behind the name of Apache Cassandra". Archived from the original on 2016-11-01. Retrieved 2016-07-19. Apache Cassandra is named after the Greek mythological prophet Cassandra. [...] Because of her beauty Apollo granted her the ability of prophecy. [...] When Cassandra of Troy refused Apollo, he put a curse on her so that all of her and her descendants' predictions would not be believed. [...] Cassandra is the cursed Oracle[.]
  8. "The Apache Software Foundation Announces Apache Cassandra Release 0.6 : The Apache Software Foundation Blog". 13 April 2010. Retrieved 5 January 2016.
  9. "The Apache Software Foundation Announces Apache Cassandra 0.7 : The Apache Software Foundation Blog". 11 January 2011. Retrieved 5 January 2016.
  10. Eric Evans. "[Cassandra-user][RELEASE] 0.8.0". Archived from the original on 8 June 2015. Retrieved 5 January 2016.
  11. "Cassandra 1.0.0. Is Ready for the Enterprise". InfoQ. Retrieved 5 January 2016.
  12. "The Apache Software Foundation Announces Apache Cassandra™ v1.1 : The Apache Software Foundation Blog". 24 April 2012. Retrieved 5 January 2016.
  13. "The Apache Software Foundation Announces Apache Cassandra™ v1.2 : The Apache Software Foundation Blog". apache.org. 2 January 2013. Retrieved 11 December 2014.
  14. Sylvain Lebresne (10 September 2014). "[VOTE SUCCESS] Release Apache Cassandra 2.1.0". mail-archive.com. Retrieved 11 December 2014.
  15. "Cassandra 2.2, 3.0, and beyond". 16 June 2015. Archived from the original on 20 April 2016. Retrieved 22 April 2016.
  16. "Cassandra Server Releases". cassandra.apache.org. Retrieved 15 December 2015.
  17. "Deploying Cassandra across Multiple Data Centers". DataStax. Retrieved 11 December 2014.
  18. "The CAP Theorem - Learn Cassandra". teddyma.gitbooks.io.
  19. 1 2 DataStax (2013-01-15). "About data consistency". Archived from the original on 2013-07-26. Retrieved 2013-07-25.
  20. "Hadoop Support" Archived 2017-11-16 at the Wayback Machine article on Cassandra's wiki
  21. "DataStax C/C++ Driver for Apache Cassandra". DataStax. Retrieved 15 December 2014.
  22. "CQL". Archived from the original on 13 January 2016. Retrieved 5 January 2016.
  23. "WAT - Cassandra: Row level consistency #$@&%*! - datanerds.io". datanerds.io. Archived from the original on 26 November 2016. Retrieved 28 November 2016.
  24. Lebresne, Sylvain (2012-02-21). "Coming up in Cassandra 1.1: Row Level Isolation". DataStax: always-on data platform | NoSQL | Apache Cassandra. Retrieved 2018-07-18.
  25. "Remove Windows scripts". Cassandra issue tracker. 2023-04-04. Retrieved 2023-04-04.
  26. Rodriguez, Alain (27 Jul 2016). "About Deletes and Tombstones in Cassandra".
  27. Ellis, Jonathan (2012-02-15). "Schema in Cassandra 1.1". DataStax. Retrieved 2013-07-25.
  28. Ellis, Jonathan (2010-12-03). "What's new in Cassandra 0.7: Secondary indexes". DataStax. Retrieved 2013-07-25.
  29. Ellis, Jonathan (2012-03-02). "The Schema Management Renaissance in Cassandra 1.1". DataStax. Retrieved 2013-07-25.
  30. Lebresne, Sylvain (2012-08-05). "Coming in 1.2: Collections support in CQL3". DataStax. Retrieved 2013-07-25.
  31. DataStax. "Apache Cassandra 0.7 Documentation - Column Families". Apache Cassandra 0.7 Documentation. Retrieved 29 October 2012.
  32. "NodeTool". Cassandra Wiki. Archived from the original on 13 January 2016. Retrieved 5 January 2016.
  33. "How to monitor Cassandra performance metrics". Datadog. 3 December 2015. Retrieved 5 January 2016.
  34. "Metrics". Cassandra Wiki. Archived from the original on 12 November 2015. Retrieved 5 January 2016.
  35. "Monitoring". Cassandra Documentation. Retrieved 1 February 2018.

Bibliography