Базы данных. Cassandra

Click here to load reader

  • date post

    25-Dec-2014
  • Category

    Technology

  • view

    857
  • download

    6

Embed Size (px)

description

Обсуждаем здесь: http://incubos.org/posts/2013/09/30/db-cassandra/

Transcript of Базы данных. Cassandra

  • 1. Cassandra http://incubos.org @incubos Computer Science Center 30 2013 . . . (CompSciCenter) Cassandra 30 2013 . 1 / 67
  • 2. 1 2 3 4 5 6 . . (CompSciCenter) Cassandra 30 2013 . 2 / 67
  • 3. History History July 2008 open-sourced by Facebook1 March 2010 graduated from the Apache Incubator Inuenced by Amazon Dynamo Committers: Rackspace, Digg, Twitter, Amazon, Microsoft 1 Facebook. Cassandra A Decentralized Structured Storage System: http://www.cs.cornell.edu/projects/ladis2009/papers/ lakshman-ladis2009.pdf . . (CompSciCenter) Cassandra 30 2013 . 3 / 67
  • 4. Features Features Decentralized no SPoF, every node is identical Multi data center replication Elastic Scalability High Availability and Fault Tolerance Tunable consistency CQL . . (CompSciCenter) Cassandra 30 2013 . 4 / 67
  • 5. Data Model Data Model Based on Google Bigtable Hybrid: Key-value + Column-oriented (): + Table A distributed multi dimensional map indexed by a key . . (CompSciCenter) Cassandra 30 2013 . 5 / 67
  • 6. ACID ACID JOIN- , rollback , ( ) Durability : commit log + replication . . (CompSciCenter) Cassandra 30 2013 . 6 / 67
  • 7. CAP CAP Tunable Consistency Tunable Availability Partition Tolerance . . (CompSciCenter) Cassandra 30 2013 . 7 / 67
  • 8. 2 : Cisco CERN Digg Facebook IBM Netix Reddit SoundCloud Twitter Odnoklassniki Yandex 2 http://db-engines.com/en/ranking/wide+column+store . . (CompSciCenter) Cassandra 30 2013 . 8 / 67
  • 9. If I had asked people what they wanted, they would have said faster horses. Henry Ford RDBMS? Chapter 1. "Whats Wrong with Relational Databases?"in "Cassandra: The Deniteve Guide"a a Eben Hewitt. Cassandra: The Denitive Guide. 2010. ISBN 1449390412. . . (CompSciCenter) Cassandra 30 2013 . 9 / 67
  • 10. RDBMS ? ! : (Distributed) Transactions3 (Distributed) JOINs (Distributed) Schema evolution Sharding4 Functional segmentation Key-based sharding Lookup table 3 Gregor Hohpe. Starbucks Does Not Use Two-Phase Commit: http://www.eaipatterns.com/ramblings/18_starbucks.html 4 Michael Stonebraker. The Case for Shared Nothing. 1986 . . (CompSciCenter) Cassandra 30 2013 . 10 / 67
  • 11. Use Case: RDBMS Scaling LiveJournal Brad Fitzpatrick. LiveJournals Backend: A history of scalinga . August 2005. a http://www.danga.com/words/2005_oscon/oscon-2005.pdf . . (CompSciCenter) Cassandra 30 2013 . 11 / 67
  • 12. Web Scale IDC. The Expanding Digital Universe5 . March 2007: YouTube: 2007 100 M videos/day, 2008 1 B videos/day Chevron: 2 TB/day Internet: 2006 166 EB, 2010 1 ZB Wall-Mart: 2000 110 TB, 2004 0.5 PB Email: 1998 253 M accounts, 2010 2 B accounts etc.6 5 http://www.emc.com/collateral/analyst-reports/ expanding-digital-idc-white-paper.pdf 6 http://highscalability.com/ . . (CompSciCenter) Cassandra 30 2013 . 12 / 67
  • 13. Cassandra , Keyspace ( per application) . . (CompSciCenter) Cassandra 30 2013 . 13 / 67
  • 14. . . (CompSciCenter) Cassandra 30 2013 . 14 / 67
  • 15. Thrift API CQL ( 3.1) SQL- ( ) . . (CompSciCenter) Cassandra 30 2013 . 15 / 67
  • 16. CQL 1 2 3 4 5 6 7 1 2 3 4 5 6 7 8 CREATE TABLE songs ( id uuid PRIMARY KEY, title text, album text, artist text, data blob ); CREATE TABLE playlists ( id uuid, song_order int, song_id uuid, title text, album text, artist text, PRIMARY KEY (id, song_order)); . . (CompSciCenter) Cassandra 30 2013 . 16 / 67
  • 17. CQL Compound keys (clustering) Indexes Collection types7 : set, list, map INSERT = UPDATE = UPSERT DELETE TTL Counters . 8 7 http://www.datastax.com/dev/blog/cql3_collections http: //www.datastax.com/documentation/cql/3.1/webhelp/index.html 8 . . (CompSciCenter) Cassandra 30 2013 . 17 / 67
  • 18. Consistent Hashing + VNodes (. 1) Gossip Partitioner Replica placement strategy Snitch ( ) . . (CompSciCenter) Cassandra 30 2013 . 18 / 67
  • 19. Virtual Nodes . . (CompSciCenter) Cassandra 30 2013 . 19 / 67
  • 20. Gossip Seed nodes Gossip- (+ dynamic snitch)9 9 Naohiro Hayashibara, Xavier Dfago, Rami Yared and Takuya Katayama. e The Accrual Failure Detector. 2008 . . (CompSciCenter) Cassandra 30 2013 . 20 / 67
  • 21. Partitioner Consistent Hashing10 Murmur3Partitioner (263 to +263 ) RandomPartitioner (0 to 2127 1) ByteOrderedPartitioner ( ) 10 http://www.datastax.com/documentation/cassandra/2.0/webhelp/ cassandra/architecture/architectureDataDistributeAbout_c.html . . (CompSciCenter) Cassandra 30 2013 . 21 / 67
  • 22. Replica Placement Strategy Replication Factor SimpleStrategy: 1 ( , ) Partitioner NetworkTopologyStrategy: (, , , ...) . . (CompSciCenter) Cassandra 30 2013 . 22 / 67
  • 23. NetworkTopologyStrategy 2 ConsistencyLevel.ONE 3 ConsistencyLevel.LOCAL_QUORUM ConsistencyLevel.ONE . . (CompSciCenter) Cassandra 30 2013 . 23 / 67
  • 24. Snitch Dynamic snitching wrapper11 , Read Latency SimpleSnitch: RackInferringSnitch: (110.dc.rack.node) PropertyFileSnitch: / GossipingPropertyFileSnitch: + Gossip 11 http://www.datastax.com/dev/blog/ dynamic-snitching-in-cassandra-past-present-and-future . . (CompSciCenter) Cassandra 30 2013 . 24 / 67
  • 25. Partitioner Replica Placement Strategy . . (CompSciCenter) Cassandra 30 2013 . 25 / 67
  • 26. Write ConsistencyLevel ConsistencyLevel , . . (CompSciCenter) Cassandra 30 2013 . 26 / 67
  • 27. Write: . . (CompSciCenter) Cassandra 30 2013 . 27 / 67
  • 28. MultiDC Write ConsistencyLevel.ON