Cassandra Data storage structure

Source: Internet
Author: User
Tags cassandra

CassandraThe data model is based on the column family (Column Family) of four or five-dimensional models. It lendsThat's it.Amazonof theDynamoand theGoogle ' sBig Table's data structure and functional characteristics, usingmemtablestored in the same way. InCassandrabefore writing the data, you need to record the log( Commitlog), and then the data begins to write toColumn Familycorresponding to thememtablein whichmemtableis a kind of according toKeyThe memory structure of the sorted data, when certain conditions are met, then thememtablethe data is flushed to disk in bulk and stored assstable.

1. Cassandra 's data Model diagram:

Basic concepts of the 2.Cassandra data model:

a node instance of Cluster:cassandra, which can contain multiple keyspace.
Keyspace:: A container for storing columnfamily , which is equivalent to a Schema or database in relational databases .

Columnfamily:: A container for storing Column , similar to the concept of table in a relational database.

Supercolumn:: It is a special column , and its value value can be more than one columnin a letter.

The most basic unit of Column::cassandra. consists of name, value, timestamp .

data storage rules in 3.Cassandra

Data: Stores the real files, both the sstable files, and multiple directories can be specified.

Commitlog: Stores data that is not written to sstable (before each write is put into a log file).

cache: The cached data in the storage system (the cache data is loaded from this directory when the service restarts).

the 4.Cassandra features are as follows:

1. Flexible schema: There is no need to pre-design the schemaas a database, adding or removing fields is very convenient (on thefly ).

2. Support range query: The Key can be queried in scope.

3. highly available, extensible: Single point of failure does not affect cluster services, linearly scalable.

5.Cassandra sorting of internal data

One thing that needs to be clear is that we useCassandra, the data is already sorted in the order it was written. In a certainKeywithin the allColumnit's all in accordance with itsNameto sort by. We can be inStorage-conf.xmlSpecifies the type of sorting in the file. CurrentlyCaSsandrathe sort types provided are:Bytestype, Utf8type,Lexicaluuidtype, Timeuuidtype, Asciitype, andLongtype. CassandraThe sorting function is allowed to be implemented by ourselves, as long as you inheritOrg.apache.cassandra.db.marshal.ITypeyou can do it.

This article references: http://www.ibm.com/developerworks/cn/opensource/os-cn-cassandra/

Http://www.cnblogs.com/ggzwtj/archive/2011/07/21/2113350.html

Http://database.51cto.com/art/201005/202153.htm

Thanks to the author of the above article for risk and sharing.

Cassandra Data storage structure

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.