1、Body Level One,Body Level Two,Body Level Three,Body Level Four,Body Level Five,Title Text,Apache Cassandra,via Docker,Chris Ballance,Diligent Corporation,ballance,What well cover,Docker Fundamentals,CAP Theorem,Cassandra Fundamentals,Demo of Cassandra deployed with Docker,Docker,Hosting&Coordination
2、Docker Hub,“GIT for Virtual Machines”,Docker Images,Ubuntu,Centos,Debian,Fedora,Cassandra,mySQL,mongoDB,Node,Java,Erlang,Ruby,Rails,Wordpress,Redis,Hipache,NGINX,Create your own!,CAP THEOREM,Project Delivery Triangle,Good,Fast,Cheap,Good,Fast,Cheap,Project Delivery Triangle,Consistent,Available,Par
3、tition Tolerant,CAP Theorem,CAP Theorem,Consistent,Available,Partition Tolerant,Available,Partition Tolerant,Consistent,Consistent,Partition Tolerant,Available,Consistent,Available,Partition Tolerant,Consistent,Available,Partition Tolerant,Partition Tolerance is a myth!,We can guarantee Consistency,
4、but not Availability.,We may time out or fail to return anything,Consistent,Available,Partition Tolerant,We can guarantee Availability,but our data may not be Consistent with other nodes,Consistent,Available,Partition Tolerant,Our business needs will drive whether,we choose Consistency or Availabili
5、ty,Partition Tolerant,Implementations,Consistent,Available,Partition Tolerant,AP,Cassandra,CouchDB,CP,MongoDB,Big Table(GFS),CA,RDBMS,SQL Server,A contrived example for,Consistency,A,B,User writes S1 to Node B,A,B,S0,S0,S1,User queries Node ANodes B&A have not syncd,A,B,S1,S0,S1,Query is blocked,unt
6、il B syncs with A,A,B,S0,S1,S1,?,Once B syncs with A,the query on A is unblocked,and returns S1 as expected,A,B,S1,S1,S1,S1,S1,:-),*The query could potentially time out,A contrived example for,Availability,A,B,User writes S1 to Node B,A,B,S1,S0,S0,User queries Node A for S1,A,B,S1,S1,S0,Query return
7、s current state of A,but is not consistent with B,A,B,S1,S1,S0,S0,S1,?,A later query of A yields S1 previously written to B.Eventual consistency has been achieved.,Idempotence,Event Sourcing,Local Caching,Queueing,A,B,S1,S1,S1,S1,S1,:-),Cassandra,History,Developed for Facebook Inbox Search,Created b
8、y one of the authors of Amazon Dynamo,Released as Open Source in 2008,Became an Apache Incubator project in 2009,Graduated to an Apache Top Level Project,Who is using Cassandra in production today?,Twitter,Netflix,Credit Suisse,Cisco,Many more,PlanetCassandra.org/companies/,Benefits,Linear Scalabili
9、ty,Data Sets can be larger than available memory,Multi-master,Built-in support for handling multiple data centers,Decentralized&Distributed-No single point of failure,Integrated caching,Consistency options can be tuned through configuration,Supports MapReduce,Familiar query syntax-CQL(Cassandra Quer
10、y Language),Designed for sparse loading of loosely typed data,Linear Scalability,Challenges,JOINs are not supported!(not unique to Cassandra),Not for financial data(eventual consistency),Tooling is not yet as mature as Oracle or SQL Server,Why NOSQL?,Multiple persistence strategies,Use the right too
11、l for the job.Sometimes more than one tool is appropriate.NoSQL can work in conjunction with SQL solutions.For example,you might have trasactions you continue to store in a Relational Database,and build your new user social graph data in a NoSQL solution.Cant decide on a local database for a mobile
12、app?Sometimes the best route is to just persist the whole thing as JSON on disk until you need something faster.,Total Cost of Ownership(TCO),Lets face it,SQL Server is expensive.If you need it,and can fully justify the cost,then it might be right for you.But as weve discussed,RDBMS can be a crutch
13、and a default choice for persistence layers.Defaults are just that,default.Theyre a catch-all that is rarely the best choice unless youre resolving generic default problems,Write(consistency two),Write(consistency two),Client,Write(consistency two),Client,Write(consistency two),Client,Coordinator,Wr
14、ite(consistency two),Client,Coordinator,Replicant,Write(consistency two),Client,Coordinator,Replicant,Replicant,Write(consistency two),Client,Coordinator,Replicant,Replicant,Confirm,Write(consistency two),Client,Coordinator,Replicant,Replicant,Time-out,Confirm,Write(consistency two),Client,Coordinat
15、or,Replicant,Replicant,Time-out,Confirm,Replicant,Write(consistency two),Client,Coordinator,Replicant,Replicant,Time-out,Confirm,Confirm,Replicant,Write(consistency two),Client,Coordinator,Replicant,Replicant,Success,Time-out,Confirm,Confirm,Replicant,Read(consistency two),Client,Read(consistency tw
16、o),Client,Read(consistency two),Client,Coordinator,Read(consistency two),Client,Coordinator,Read(consistency two),Client,Coordinator,Chosen Node,Chosen Node,Read(consistency two),Client,Coordinator,Chosen Node,Chosen Node,Read(consistency two),Client,Coordinator,Inconsistent,Node,Chosen Node,Read(co
17、nsistency two),Client,Coordinator,Chosen Node,Inconsistent,Node,Read(consistency two),Client,Coordinator,Chosen Node,Chosen Node,Inconsistent,Node,Read(consistency two),Client,Coordinator,Chosen Node,Chosen Node,Inconsistent,Node,Read(consistency two),Client,Coordinator,Chosen Node,Chosen Node,Incon
18、sistent,Node,Success,On-premise+Cloud,Consistency Modes,ALL,-Every node must have the data,QUORUM,-Most nodes must have the data,ONE,-At least one node must have the data,TWO,-At least two nodes must have the data,THREE,-At least three Nodes must have the data,ANY,-Any node has the data,EACH_QUORUM,
19、Each datacenter must have a quorum,LOAL_QUORUM,-Each node in the datacenter handling the request must have a quorum*Quorum=(replication_factor/2)+1,Calculating Consistency,R+W N,R Read level consistency,W Write level consistency,N Number of replicas of the data,Data Replication,SimpleStrategy,-Sing
20、le data center,NetworkTopologyStrategy,-Recommended strategy for multiple data centers.Provides Cassandra with info about the location of nodes by rack and datacenter,Deploying Cassandra with Docker,Demo,Additional Resources,Apache Cassandra,cassandra.apache.org/,Docker,Hub,for Developers-Paul OFallon,Guid to NoSQL:Apache Cassandra(Free eBook),is.gd/CassandraFreeEbook,Cassandra 3.0-DataStax PDF,






