0% found this document useful (0 votes)
7 views9 pages

Module 1 Introduction

NoSQL databases, which stand for 'Not only SQL', provide a flexible, scalable alternative to traditional relational databases, designed to handle large volumes of unstructured and semi-structured data. They come in various types, including document-based, key-value, column-oriented, and graph databases, each suited for specific use cases. The CAP Theorem outlines the trade-offs between consistency, availability, and partition tolerance in distributed systems, influencing the design of NoSQL databases.

Uploaded by

dubeygaurav622
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views9 pages

Module 1 Introduction

NoSQL databases, which stand for 'Not only SQL', provide a flexible, scalable alternative to traditional relational databases, designed to handle large volumes of unstructured and semi-structured data. They come in various types, including document-based, key-value, column-oriented, and graph databases, each suited for specific use cases. The CAP Theorem outlines the trade-offs between consistency, availability, and partition tolerance in distributed systems, influencing the design of NoSQL databases.

Uploaded by

dubeygaurav622
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Introduction

Introduction to NoSQL
In the world of databases, there are many different ways to organize and store data. At this point, we are
familiar with the concept of relational databases that store data in rows, form relationships between the
tables, and query the data using SQL. However, a new type of database, NoSQL, started to rise in popularity
in the early 21st century.
NoSQL is short for “not-only SQL”, but is also commonly called “non-relational” or “non-SQL”. Any
database technology that stores data differently from relational databases can be categorized as a NoSQL
database.
What Is NoSQL?
NoSQL, which stands for "Not only SQL," refers to a diverse set of database technologies that differ from
traditional relational databases (SQL databases) in how they store and retrieve data. NoSQL databases are
designed to handle large volumes of unstructured, semi-structur ed, and structured data more efficiently and
flexibly than traditional databases. They are particularly suited for applications where high performance,
scalability, and flexibility are crucial, such as real-time web applications, big data analytics, content
management systems, and IoT (Internet of Things) platforms.
Why NoSQL databases are required.
NoSQL databases are often chosen over traditional relational databases (SQL databases) for several reasons,
depending on the specific needs and characteristics of the application or system:
1. Scalability: NoSQL databases are designed to horizontally scale out across many servers, which makes
them suitable for handling large amounts of data and high traffic levels.
2. Flexibility and Schema-less Design: Unlike relational databases, which require a predefined schema,
NoSQL databases typically have a flexible schema or are schema-less. This means they can handle semi-
structured or unstructured data more easily.
3. High Performance: NoSQL databases are optimized for specific data models and access patterns. They
can often outperform relational databases for certain types of queries, especially those involving large
volumes of data or those that can be distributed across nodes.
4. Support for Distributed Computing: Many NoSQL databases are designed with distributed computing in
mind, making them suitable for cloud-based deployments and environments where data needs to be
available across different regions or data centers.
5. Specialized Data Models: NoSQL databases offer different data models (such as key-value, document,
column-family, or graph databases), each suited for different types of data and use cases.
6. Horizontal Scaling and Fault Tolerance: NoSQL databases typically provide built-in mechanisms for
replication and partitioning that ensure high availability and fault tolerance. This is crucial for applications
that require continuous operation even in the event of hardware failures or network issues.
7. Cost-effectiveness: NoSQL databases can often be more cost-effective than traditional relational
databases, especially when dealing with large-scale data storage and processing. They can run on
commodity hardware and often require less upfront investment in terms of licensing and infrastructure.
8. Use Cases: NoSQL databases are well-suited for certain use cases such as real-time web applications, IoT
data storage and retrieval, caching, session management, and analytics where fast read and write operations
are critical.
Types of NoSQL Database
A database is a collection of structured data or information which is stored in a computer system and can be
accessed easily. A database is usually managed by a Database Management System (DBMS).

NoSQL is a non-relational database that is used to store the data in the nontabular form. NoSQL stands for
Not only SQL. The main types are documents, key-value, wide-column, and graphs.

Types of NoSQL Database:


 Document-based databases
 Key-value stores
 Column-oriented databases
 Graph-based databases

Document-Based Database:
The document-based database is a nonrelational database. Instead of storing the data in rows and columns
(tables), it uses the documents to store the data in the database. A document database stores data in JSON,
BSON, or XML documents.
Documents can be stored and retrieved in a form that is much closer to the data objects used in applications
which means less translation is required to use these data in the applications. In the Document database, the
particular elements can be accessed by using the index value that is assigned for faster querying.
Key-Value Stores:
A key-value store is a nonrelational database. The simplest form of a NoSQL database is a key-value store.
Every data element in the database is stored in key-value pairs. The data can be retrieved by using a unique
key allotted to each element in the database. The values can be simple data types like strings and numbers or
complex objects.
A key-value store is like a relational database with only two columns which is the key and the value.
Key features of the key-value store:
 Simplicity.
 Scalability.
 Speed.
Column Oriented Databases:
A column-oriented database is a non-relational database that stores the data in columns instead of rows. That
means when we want to run analytics on a small number of columns, you can read those columns directly
without consuming memory with the unwanted data.
Columnar databases are designed to read data more efficiently and retrieve the data with greater speed. A
columnar database is used to store a large amount of data. Key features of columnar oriented database:
 Scalability.
 Compression.
 Very responsive.
Graph-Based databases:
Graph-based databases focus on the relationship between the elements. It stores the data in the form of nodes
in the database. The connections between the nodes are called links or relationships.
Key features of graph database:
 In a graph-based database, it is easy to identify the relationship between the data by using the links.
 The Query’s output is real-time results.
 The speed depends upon the number of relationships among the database elements.
 Updating data is also easy, as adding a new node or edge to a graph database is a straightforward task
that does not require sign-ificant schema changes.

Differences between SQL and NoSQL


The table below summarizes the main differences between SQL and NoSQL databases.

SQL NoSQL

Document: JSON documents, Key-value: key-value pairs, Wide-


Data Storage Tables with fixed rows
column: tables with rows and dynamic columns, Graph: nodes and
Model and columns
edges

Developed in the 1970s


Development Developed in the late 2000s with a focus on scaling and allowing
with a focus on reducing
History for rapid application change driven by agile and DevOps practices.
data duplication

Oracle, MySQL, Document: MongoDB and CouchDB, Key-value: Redis and


Examples Microsoft SQL Server, DynamoDB, Wide-column: Cassandra and HBase, Graph: Neo4j
and PostgreSQL and Amazon Neptune

Document: general purpose, Key-value: large amounts of data with


simple lookup queries, Wide-column: large amounts of data with
Primary Purpose General purpose
predictable query patterns, Graph: analyzing and traversing
relationships between connected data

Schemas Rigid Flexible

Vertical (scale-up with a


Scaling Horizontal (scale-out across commodity servers)
larger server)

Multi-Record
Most do not support multi-record ACID transactions. However,
ACID Supported
some — like MongoDB — do.
Transactions

Joins Typically required Typically, not required

Data to Object Requires ORM (object- Many do not require ORMs. MongoDB documents map directly to
Mapping relational mapping) data structures in most popular programming languages.

CAP Theorem
The CAP Theorem, also known as Brewer's Theorem, states that in a distributed data store, it is impossible
to simultaneously achieve all three of the following guarantees:
1. Consistency: Every read receives the most recent write or an error.
2. Availability: Every request receives a response, without guaranteeing that it contains the most recent
write.
3. Partition tolerance: The system continues to operate despite network partitions (communication failures)
between nodes.
According to the CAP Theorem, a distributed system can guarantee at most two out of these three properties
at any given time. Therefore, database systems must make trade-offs in their design and implementation
based on the specific needs of their applications and environments.

CA (Consistency and Availability)-


The system prioritizes availability over consistency and can respond with possibly stale data.
Example databases: Cassandra, CouchDB, Riak, Voldemort.
AP (Availability and Partition Tolerance)-
The system prioritizes availability over consistency and can respond with possibly stale data.
The system can be distributed across multiple nodes and is designed to operate reliably even in the face of
network partitions.
Example databases: Amazon DynamoDB, Google Cloud Spanner.
CP (Consistency and Partition Tolerance)-
The system prioritizes consistency over availability and responds with the latest updated data.
The system can be distributed across multiple nodes and is designed to operate reliably even in the face of
network partitions.
Example databases: Apache HBase, MongoDB, Redis.

Installation
Step 1 :-
- Check for the mount point with good amount of space using command "df -h"

- Here in my case there is 3.6GB of space available in '/' mount point, so i am going to install my software in
'/' mount point.
Step 2 :-
- Now we will create required directories for software installations.

- As you can we have created mymongo directory and under mymongo directory we have created two more
directories which was log and data.
Step 3 :-
- In the next step we will copy the link of software from mongodb website.
https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-6.0.15.tgz

- In my case i have selected platform ubuntu 22.04 x64 because i am using ubuntu os 22.04 release.
Step 4 :-
- Now we will paste that copied link in our terminal using command "wget"
root@you-VirtualBox: /mymongo# wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-
ubuntu2204-6.0.1 5.tgz

- Output of above command.


Step 5 :-
- Now we will extract that file using command "tar -xvf".

- As you can see we have extracted mongodb software file successfully.


Step 6 :-
- Now we will create configuration file to start our database.
- This is mongod.conf file details.
- We have created configuration file.
Step 7 :-
- We will start the services of our database.

- to check whether services has started or not execute command "ps -ef | grep mongo" in duplicate terminal.
- until here we have successfully installed our mongodb software.
Step 8 :-
- Now we will download the mongodb shell to use our database. for that we will copy the link of
mongodb shell from website.
https://downloads.mongodb.com/compass/mongosh-2.2.5-linux-x64.tgz

- copy the link.


Step 9 :-
- In a new terminal, cd to /mymongo directory and paste our copied link using command "wget".
Step 10 :-
- Now we will extract mongodb shell file using "tar -xvf" command.

- we have successfully extracted mongodb shell file


Step 11 :-
- Now we will start our database.

- We have successfully Installed Mongodb database on our ubuntu 22.04 os.


Start and stop the mongodb process
To start the mongodb services we will use below step :
Command :-
- "First your directory/binaries/bin/mongod -f/directory name/config file name".
we have started the services of mongodb.

- we have started the services of mongodb.


- To check whether the services are properly started or not execute below command in duplicate terminal :-

- As we can see mongodb services has been started successfully. now we can connect to our database.

To stop the process of mongdb we will use below command :-


- To stop the mongodb services we will simply kill the process which we have started previously using
"kill" command.

- we have stopped the services of mongodb.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy