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
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
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/
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
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.