Apache Cassandra and MongoDB

Posted By : Arun Kataria | 30-Oct-2017

Apache Cassandra:-

Apache Cassandra was developed and released by Facebook in 2008. The database adopts concepts of both Amazon’s DynamoDB and Google’s Bigtable. Cassandra is was distributed database built to handle very large amounts of structured data and be highly available. It is a decentralized structured distributed storage system. It is built to agile, availability demands of IOT and is built for the performance and mobile applications. One of a key features of the Cassandra from end users perspective is easy-of-user rather than familiar, CQL(Cassandra query language) was introduce with the Cassandra 0.8 release with the intention of having an RDBMS style SQL (structured query language). Since its inception. It is written in Java, It stores data in SQL format. Cassandra is distributed database system for high performance . It got the license by Apache.

 

Cassandra replicates data to several nodes is in the cluster in order to provide high availability. As the CAP theorem dictates, there is a necessary trade-off between data consistency and availability. Cassandra lets you choose what kind of trade-off you are willing to make. Availability and consistency are tunable by altering three values, N, W and R. N was a number of nodes data should be replicated to, W is the number of nodes that must complete a write to be considered successful, R is the number of nodes that must respond issuccessfuly to read. Cassandra does not offer ACID transactions with rollback or locking mechanism as in the relational database. A write is atomic, isolated and durable at the row-level, which means that updating multiple columns for the given of row and key is considered as a single write operation and will be succeed or fail.

 

Install Cassandra using the DC/OS CLI:

dcos package install cassandra
Installing Marathon app for package [cassandra] version [1.0.0-2.2.5]
Installing CLI subcommand for package [cassandra] version [1.0.0-2.2.5]
New command available: dcos cassandra
DC/OS Cassandra Service is being installed.

MongoDB:-

Like as Cassandra MongoDB is also a NoSQL database. It is document-oriented database system and cross-platform that eschews the traditional table-based relational database structure in favor of JSON-like documents with dynamic schemas making the integration of data in certain types of applications was easier and fast. No joins and embedding makes reads and writes fast in MongoDB. Availability of a lot of useful features like embedded docs for speed, manageability, agile development with schema-less databases, easier horizontal scalability because joins aren’t as important. Fields are stored in a key-value pair. A value is a basic type like string, integer, float, timestamp, binary, a document, or an array of values. It is writen in C++ and it stores data in JSON format.It stores data in the form of BSON4 documents and each document belongs to a collection. The documents in a collection are related to each other but can vary in structure because MongoDB is schema-free. A MongoDB server can have multiple databases where each database contains one or more collections.The field "_id" is required in all documents and is used as a primary key. Its value is immutable and uniquely identifies a document in a collection.

 

To support scalability, MongoDB uses both replication and sharding. It uses a variant of master-slave replication called replica sets. A replica set is a group of servers containing the same data. One server is the master that receives all write-operations. The data is then replicated to the other servers, the slaves. When the master is not available, a new master can be elected automatically among the slaves. To scale for reads, more slaves can be added to a replica set and then direct all reads to the slaves. To
scale for writes, it doesn’t help to add more nodes and therefore sharding is used. MongoDB is a consistent database by default but can be configured by specifying how many slaves a write operation should be replicated to before it returns. MongoDB has support for ACID transactions at the level of a single document. A transaction that modifies multiple documents is not possible.

Link to install MongoDB -> https://docs.mongodb.com/manual/installation/

About Author

Author Image
Arun Kataria

Arun has good skills in AngularJS, NodeJS, MongoDB and many more. He is highly motivated which allow him to strive for proficiency when accomplishing assigned duties. He is an excellent team operative.

Request for Proposal

Name is required

Comment is required

Sending message..