SlideShare a Scribd company logo
MongoDB and DynamoDB
September 8, 2020
Md Minhazul Haque
hello@mdminhazulhaque.io
What is NoSQL
● Stands for Not SQL
● No relational form, No schema
● No storing data in tables
● Supports sharding for data partitioning
● Different adaption to NoSQL
○ Document Based: MongoDB, CouchDB
○ Key-value Based: DynamoDB, Redis
Why use MongoDB
● Scalable horizontally unlike RDBMS
● Supports dynamic Data Structure
● Caching not needed for performance tuning
● Saves time in designing database
● More agile
NoSQL vs RDBMS Terms
MongoDB SQL
Database Database
Collection Table
Index Index
Document Row
Field Column
Link/Embed Join
Who uses MongoDB
Who uses MongoDB
Setting Up MongoDB
Setting Up MongoDB
# ubuntu
sudo apt install mongodb-server mongodb-clients
# centos
sudo yum install -y mongodb-org-4.4.0
mongodb-org-server-4.4.0 mongodb-org-shell-4.4.0
mongodb-org-mongos-4.4.0 mongodb-org-tools-4.4.0
Starting MongoDB Daemon
mongod
mongod --dbpath /my/custom/path
mongod --port 27017
mongod --bind_ip 127.0.0.1
mongod --config /etc/mongodb.conf
Mongod --replSet prod_replica
Accessing MongoDB using Client
mongo
mongo 127.0.0.1
mongo 127.0.0.1:27017
mongo 127.0.0.1:27017/formapply
MongoDB: Create Query
> show dbs
admin 0.000GB
config 0.000GB
local 0.000GB
> use users
switched to db users
> db.users.insert({name:"Foo Bar"})
WriteResult({ "nInserted" : 1 })
MongoDB: Read Query
> use users
> db.users.find({})
{ "_id" : ObjectId("5f5659472eef8cb6bf6a02f1"),
"name" : "Foo Bar" }
MongoDB: Update Query
> db.users.update({}, {$set: {name:"Tanvir
JurisTech"}})
WriteResult({ "nMatched" : 1, "nUpserted" : 0,
"nModified" : 1 })
> db.users.find({})
{ "_id" : ObjectId("5f5659472eef8cb6bf6a02f1"),
"name" : "Tanvir JurisTech" }
MongoDB: Delete Query
> db.users.remove({name:"Tanvir JurisTech"})
WriteResult({ "nRemoved" : 1 })
> db.users.find({})
>
MongoDB: Replica Set
mongod --dbpath /data/db1 --port 27001 --replSet
prod
mongod --dbpath /data/db2 --port 27002 --replSet
prod
mongod --dbpath /data/db3 --port 27003 --replSet
prod
MongoDB: Replica Set
> rs.initiate( {
_id : "prod",
members: [
{ _id: 0, host: "127.0.0.1:27001" },
{ _id: 1, host: "127.0.0.1:27002" }
]
})
{
"ok" : 1,
"operationTime" : Timestamp(1599495296, 1),
...
}
MongoDB: Replica Set
> mongo 127.0.0.1:27001
prod:PRIMARY> use messages
switched to db messages
prod:PRIMARY> db.messages.find({})
prod:PRIMARY> db.messages.insert({message:"Hello World!"})
WriteResult({ "nInserted" : 1 })
> mongo 127.0.0.1:27002
prod:SECONDARY> rs.slaveOk()
prod:SECONDARY> use messages
switched to db messages
prod:SECONDARY> db.messages.find({})
{ "_id" : ObjectId("5f565dcc832cf9e810aeea2d"), "message" :
"Hello World!" }
MongoDB: Replica Set
> mongo 127.0.0.1:27001
prod:PRIMARY> rs.add({ _id: 2, host: "127.0.0.1:27003" }
> prod:SECONDARY> rs.conf()
{
"_id" : "prod",
"members" : [
{
"host" : "127.0.0.1:27001",
},
{
"host" : "127.0.0.1:27002",
},
{
"host" : "127.0.0.1:27003",
}
]
}
MongoDB: Replica Set
> mongo 127.0.0.1:27001
prod:PRIMARY>
2020-09-08T00:28:05.646+0800 I NETWORK [thread1] trying
reconnect to 127.0.0.1:27001 (127.0.0.1) failed
2020-09-08T00:28:05.646+0800 W NETWORK [thread1] Failed to
connect to 127.0.0.1:27001, in(checking socket for error after
poll), reason: Connection refused
2020-09-08T00:28:05.646+0800 I NETWORK [thread1] reconnect
127.0.0.1:27001 (127.0.0.1) failed failed
# stop mongodb on port 27001
> mongo 127.0.0.1:27002
prod:SECONDARY>
prod:SECONDARY>
prod:PRIMARY>
prod:PRIMARY>
prod:PRIMARY>
prod:PRIMARY>
DynamoDB
Why use DynamoDB
● Key-value based database at scale
● Serverless (managed by AWS)
● Auto scaling on enterprise level
● Read/Write capacity mode
● Realtime Trigger/Streams
● Priced on Read/Write operation*
● Automatic replication among AZ
● Handy HTTP API
Who uses DynamoDB
DynamoDB: Create Table
DynamoDB: Create Table
DynamoDB: Create Table
DynamoDB: Insert Item
DynamoDB: Insert Item
DynamoDB: Update Item
DynamoDB: Delete Item
Q&A
More references
● https://www.mongodb.com/nosql-explained/nosql-vs-sql
● https://www.featuredcustomers.com/vendor/amazon-dynamodb/customers
● https://bits.mdminhazulhaque.io/mongodb/mongodb-for-mysql-people.html
● https://bits.mdminhazulhaque.io/aws/aws-cli-cheatsheet.html#dynamodb
● https://aws.amazon.com/dynamodb/features/
● https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GettingStar
ted.PHP.html

More Related Content

What's hot

Migrating from InnoDB and HBase to MyRocks at Facebook
Migrating from InnoDB and HBase to MyRocks at FacebookMigrating from InnoDB and HBase to MyRocks at Facebook
Migrating from InnoDB and HBase to MyRocks at Facebook
MariaDB plc
 
Writing powerful stored procedures in PL/SQL
Writing powerful stored procedures in PL/SQLWriting powerful stored procedures in PL/SQL
Writing powerful stored procedures in PL/SQL
MariaDB plc
 
Gab document db scaling database
Gab   document db scaling databaseGab   document db scaling database
Gab document db scaling database
MUG Perú
 
Scylla Summit 2018: Scylla Feature Talks - Gains by Using Scylla-Specific Dri...
Scylla Summit 2018: Scylla Feature Talks - Gains by Using Scylla-Specific Dri...Scylla Summit 2018: Scylla Feature Talks - Gains by Using Scylla-Specific Dri...
Scylla Summit 2018: Scylla Feature Talks - Gains by Using Scylla-Specific Dri...
ScyllaDB
 
Simple Db & Dynamo Db
Simple Db & Dynamo DbSimple Db & Dynamo Db
Simple Db & Dynamo Db
Uchit Vyas ☁
 
How MariaDB is approaching DBaaS
How MariaDB is approaching DBaaSHow MariaDB is approaching DBaaS
How MariaDB is approaching DBaaS
MariaDB plc
 
iForum 2015: SQL vs. NoSQL
iForum 2015: SQL vs. NoSQLiForum 2015: SQL vs. NoSQL
iForum 2015: SQL vs. NoSQL
Денис Резник
 
Scaling Pinterest
Scaling PinterestScaling Pinterest
Scaling Pinterest
C4Media
 
Running Scylla on Kubernetes with Scylla Operator
Running Scylla on Kubernetes with Scylla OperatorRunning Scylla on Kubernetes with Scylla Operator
Running Scylla on Kubernetes with Scylla Operator
ScyllaDB
 
Azure PaaS databases
Azure PaaS databasesAzure PaaS databases
Azure PaaS databases
Gianluca Hotz
 
Clustered Columnstore - Deep Dive
Clustered Columnstore - Deep DiveClustered Columnstore - Deep Dive
Clustered Columnstore - Deep Dive
Niko Neugebauer
 
Columnstore improvements in SQL Server 2016
Columnstore improvements in SQL Server 2016Columnstore improvements in SQL Server 2016
Columnstore improvements in SQL Server 2016
Niko Neugebauer
 
How & When to Use NoSQL at Websummit Dublin
How & When to Use NoSQL at Websummit DublinHow & When to Use NoSQL at Websummit Dublin
How & When to Use NoSQL at Websummit Dublin
Amazon Web Services
 
Global Data Replication with Galera for Ansell Guardian®
Global Data Replication with Galera for Ansell Guardian®Global Data Replication with Galera for Ansell Guardian®
Global Data Replication with Galera for Ansell Guardian®
MariaDB plc
 
Running MySQL in AWS
Running MySQL in AWSRunning MySQL in AWS
Running MySQL in AWS
Laine Campbell
 
GridFS: The Perfect Solution for Media Storage
GridFS: The Perfect Solution for Media StorageGridFS: The Perfect Solution for Media Storage
GridFS: The Perfect Solution for Media Storage
MongoDB
 
Azure document db/Cosmos DB
Azure document db/Cosmos DBAzure document db/Cosmos DB
Azure document db/Cosmos DB
Mohit Chhabra
 
Elephants vs. Dolphins: Comparing PostgreSQL and MySQL for use in the DoD
Elephants vs. Dolphins:  Comparing PostgreSQL and MySQL for use in the DoDElephants vs. Dolphins:  Comparing PostgreSQL and MySQL for use in the DoD
Elephants vs. Dolphins: Comparing PostgreSQL and MySQL for use in the DoD
Jamey Hanson
 
Products.intro.forum version
Products.intro.forum versionProducts.intro.forum version
Products.intro.forum version
sqlserver.co.il
 
Introduction to CosmosDB - Azure Bootcamp 2018
Introduction to CosmosDB - Azure Bootcamp 2018Introduction to CosmosDB - Azure Bootcamp 2018
Introduction to CosmosDB - Azure Bootcamp 2018
Josh Carlisle
 

What's hot (20)

Migrating from InnoDB and HBase to MyRocks at Facebook
Migrating from InnoDB and HBase to MyRocks at FacebookMigrating from InnoDB and HBase to MyRocks at Facebook
Migrating from InnoDB and HBase to MyRocks at Facebook
 
Writing powerful stored procedures in PL/SQL
Writing powerful stored procedures in PL/SQLWriting powerful stored procedures in PL/SQL
Writing powerful stored procedures in PL/SQL
 
Gab document db scaling database
Gab   document db scaling databaseGab   document db scaling database
Gab document db scaling database
 
Scylla Summit 2018: Scylla Feature Talks - Gains by Using Scylla-Specific Dri...
Scylla Summit 2018: Scylla Feature Talks - Gains by Using Scylla-Specific Dri...Scylla Summit 2018: Scylla Feature Talks - Gains by Using Scylla-Specific Dri...
Scylla Summit 2018: Scylla Feature Talks - Gains by Using Scylla-Specific Dri...
 
Simple Db & Dynamo Db
Simple Db & Dynamo DbSimple Db & Dynamo Db
Simple Db & Dynamo Db
 
How MariaDB is approaching DBaaS
How MariaDB is approaching DBaaSHow MariaDB is approaching DBaaS
How MariaDB is approaching DBaaS
 
iForum 2015: SQL vs. NoSQL
iForum 2015: SQL vs. NoSQLiForum 2015: SQL vs. NoSQL
iForum 2015: SQL vs. NoSQL
 
Scaling Pinterest
Scaling PinterestScaling Pinterest
Scaling Pinterest
 
Running Scylla on Kubernetes with Scylla Operator
Running Scylla on Kubernetes with Scylla OperatorRunning Scylla on Kubernetes with Scylla Operator
Running Scylla on Kubernetes with Scylla Operator
 
Azure PaaS databases
Azure PaaS databasesAzure PaaS databases
Azure PaaS databases
 
Clustered Columnstore - Deep Dive
Clustered Columnstore - Deep DiveClustered Columnstore - Deep Dive
Clustered Columnstore - Deep Dive
 
Columnstore improvements in SQL Server 2016
Columnstore improvements in SQL Server 2016Columnstore improvements in SQL Server 2016
Columnstore improvements in SQL Server 2016
 
How & When to Use NoSQL at Websummit Dublin
How & When to Use NoSQL at Websummit DublinHow & When to Use NoSQL at Websummit Dublin
How & When to Use NoSQL at Websummit Dublin
 
Global Data Replication with Galera for Ansell Guardian®
Global Data Replication with Galera for Ansell Guardian®Global Data Replication with Galera for Ansell Guardian®
Global Data Replication with Galera for Ansell Guardian®
 
Running MySQL in AWS
Running MySQL in AWSRunning MySQL in AWS
Running MySQL in AWS
 
GridFS: The Perfect Solution for Media Storage
GridFS: The Perfect Solution for Media StorageGridFS: The Perfect Solution for Media Storage
GridFS: The Perfect Solution for Media Storage
 
Azure document db/Cosmos DB
Azure document db/Cosmos DBAzure document db/Cosmos DB
Azure document db/Cosmos DB
 
Elephants vs. Dolphins: Comparing PostgreSQL and MySQL for use in the DoD
Elephants vs. Dolphins:  Comparing PostgreSQL and MySQL for use in the DoDElephants vs. Dolphins:  Comparing PostgreSQL and MySQL for use in the DoD
Elephants vs. Dolphins: Comparing PostgreSQL and MySQL for use in the DoD
 
Products.intro.forum version
Products.intro.forum versionProducts.intro.forum version
Products.intro.forum version
 
Introduction to CosmosDB - Azure Bootcamp 2018
Introduction to CosmosDB - Azure Bootcamp 2018Introduction to CosmosDB - Azure Bootcamp 2018
Introduction to CosmosDB - Azure Bootcamp 2018
 

Similar to MongoDB and DynamoDB

Mongodb workshop
Mongodb workshopMongodb workshop
Mongodb workshop
Harun Yardımcı
 
MongoDB
MongoDBMongoDB
MongoDB
wiTTyMinds1
 
Building Hybrid data cluster using PostgreSQL and MongoDB
Building Hybrid data cluster using PostgreSQL and MongoDBBuilding Hybrid data cluster using PostgreSQL and MongoDB
Building Hybrid data cluster using PostgreSQL and MongoDB
Ashnikbiz
 
Introduction to MongoDB with PHP
Introduction to MongoDB with PHPIntroduction to MongoDB with PHP
Introduction to MongoDB with PHP
fwso
 
MongoDB basics & Introduction
MongoDB basics & IntroductionMongoDB basics & Introduction
MongoDB basics & Introduction
Jerwin Roy
 
MongoDB and Node.js
MongoDB and Node.jsMongoDB and Node.js
MongoDB and Node.js
Norberto Leite
 
Webinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.jsWebinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.js
MongoDB
 
Webinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.jsWebinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.js
MongoDB
 
introtomongodb
introtomongodbintrotomongodb
introtomongodb
saikiran
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDB
MongoDB
 
Get expertise with mongo db
Get expertise with mongo dbGet expertise with mongo db
Get expertise with mongo db
Amit Thakkar
 
BedCon 2013 - Java Persistenz-Frameworks für MongoDB
BedCon 2013 - Java Persistenz-Frameworks für MongoDBBedCon 2013 - Java Persistenz-Frameworks für MongoDB
BedCon 2013 - Java Persistenz-Frameworks für MongoDB
Tobias Trelle
 
MongoDB World 2018: Bumps and Breezes: Our Journey from RDBMS to MongoDB
MongoDB World 2018: Bumps and Breezes: Our Journey from RDBMS to MongoDBMongoDB World 2018: Bumps and Breezes: Our Journey from RDBMS to MongoDB
MongoDB World 2018: Bumps and Breezes: Our Journey from RDBMS to MongoDB
MongoDB
 
Introduction to mongo db
Introduction to mongo dbIntroduction to mongo db
Introduction to mongo db
NexThoughts Technologies
 
How to use MongoDB with CakePHP
How to use MongoDB with CakePHPHow to use MongoDB with CakePHP
How to use MongoDB with CakePHP
ichikaway
 
Setting up mongodb sharded cluster in 30 minutes
Setting up mongodb sharded cluster in 30 minutesSetting up mongodb sharded cluster in 30 minutes
Setting up mongodb sharded cluster in 30 minutes
Sudheer Kondla
 
MongoDB: Advantages of an Open Source NoSQL Database
MongoDB: Advantages of an Open Source NoSQL DatabaseMongoDB: Advantages of an Open Source NoSQL Database
MongoDB: Advantages of an Open Source NoSQL Database
FITC
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
Chun-Kai Wang
 
Building your first app with MongoDB
Building your first app with MongoDBBuilding your first app with MongoDB
Building your first app with MongoDB
Norberto Leite
 
進階使用Nodejs 淺談no sql(mongodb)
進階使用Nodejs 淺談no sql(mongodb)進階使用Nodejs 淺談no sql(mongodb)
進階使用Nodejs 淺談no sql(mongodb)
Simon Su
 

Similar to MongoDB and DynamoDB (20)

Mongodb workshop
Mongodb workshopMongodb workshop
Mongodb workshop
 
MongoDB
MongoDBMongoDB
MongoDB
 
Building Hybrid data cluster using PostgreSQL and MongoDB
Building Hybrid data cluster using PostgreSQL and MongoDBBuilding Hybrid data cluster using PostgreSQL and MongoDB
Building Hybrid data cluster using PostgreSQL and MongoDB
 
Introduction to MongoDB with PHP
Introduction to MongoDB with PHPIntroduction to MongoDB with PHP
Introduction to MongoDB with PHP
 
MongoDB basics & Introduction
MongoDB basics & IntroductionMongoDB basics & Introduction
MongoDB basics & Introduction
 
MongoDB and Node.js
MongoDB and Node.jsMongoDB and Node.js
MongoDB and Node.js
 
Webinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.jsWebinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.js
 
Webinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.jsWebinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.js
 
introtomongodb
introtomongodbintrotomongodb
introtomongodb
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDB
 
Get expertise with mongo db
Get expertise with mongo dbGet expertise with mongo db
Get expertise with mongo db
 
BedCon 2013 - Java Persistenz-Frameworks für MongoDB
BedCon 2013 - Java Persistenz-Frameworks für MongoDBBedCon 2013 - Java Persistenz-Frameworks für MongoDB
BedCon 2013 - Java Persistenz-Frameworks für MongoDB
 
MongoDB World 2018: Bumps and Breezes: Our Journey from RDBMS to MongoDB
MongoDB World 2018: Bumps and Breezes: Our Journey from RDBMS to MongoDBMongoDB World 2018: Bumps and Breezes: Our Journey from RDBMS to MongoDB
MongoDB World 2018: Bumps and Breezes: Our Journey from RDBMS to MongoDB
 
Introduction to mongo db
Introduction to mongo dbIntroduction to mongo db
Introduction to mongo db
 
How to use MongoDB with CakePHP
How to use MongoDB with CakePHPHow to use MongoDB with CakePHP
How to use MongoDB with CakePHP
 
Setting up mongodb sharded cluster in 30 minutes
Setting up mongodb sharded cluster in 30 minutesSetting up mongodb sharded cluster in 30 minutes
Setting up mongodb sharded cluster in 30 minutes
 
MongoDB: Advantages of an Open Source NoSQL Database
MongoDB: Advantages of an Open Source NoSQL DatabaseMongoDB: Advantages of an Open Source NoSQL Database
MongoDB: Advantages of an Open Source NoSQL Database
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Building your first app with MongoDB
Building your first app with MongoDBBuilding your first app with MongoDB
Building your first app with MongoDB
 
進階使用Nodejs 淺談no sql(mongodb)
進階使用Nodejs 淺談no sql(mongodb)進階使用Nodejs 淺談no sql(mongodb)
進階使用Nodejs 淺談no sql(mongodb)
 

Recently uploaded

Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfNunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
flufftailshop
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Tatiana Kojar
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Finale of the Year: Apply for Next One!
Finale of the Year: Apply for Next One!Finale of the Year: Apply for Next One!
Finale of the Year: Apply for Next One!
GDSC PJATK
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
LucaBarbaro3
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStrDeep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
saastr
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
AWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptxAWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptx
HarisZaheer8
 

Recently uploaded (20)

Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfNunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Finale of the Year: Apply for Next One!
Finale of the Year: Apply for Next One!Finale of the Year: Apply for Next One!
Finale of the Year: Apply for Next One!
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStrDeep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
AWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptxAWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptx
 

MongoDB and DynamoDB

  • 1. MongoDB and DynamoDB September 8, 2020 Md Minhazul Haque hello@mdminhazulhaque.io
  • 2. What is NoSQL ● Stands for Not SQL ● No relational form, No schema ● No storing data in tables ● Supports sharding for data partitioning ● Different adaption to NoSQL ○ Document Based: MongoDB, CouchDB ○ Key-value Based: DynamoDB, Redis
  • 3. Why use MongoDB ● Scalable horizontally unlike RDBMS ● Supports dynamic Data Structure ● Caching not needed for performance tuning ● Saves time in designing database ● More agile
  • 4. NoSQL vs RDBMS Terms MongoDB SQL Database Database Collection Table Index Index Document Row Field Column Link/Embed Join
  • 8. Setting Up MongoDB # ubuntu sudo apt install mongodb-server mongodb-clients # centos sudo yum install -y mongodb-org-4.4.0 mongodb-org-server-4.4.0 mongodb-org-shell-4.4.0 mongodb-org-mongos-4.4.0 mongodb-org-tools-4.4.0
  • 9. Starting MongoDB Daemon mongod mongod --dbpath /my/custom/path mongod --port 27017 mongod --bind_ip 127.0.0.1 mongod --config /etc/mongodb.conf Mongod --replSet prod_replica
  • 10. Accessing MongoDB using Client mongo mongo 127.0.0.1 mongo 127.0.0.1:27017 mongo 127.0.0.1:27017/formapply
  • 11. MongoDB: Create Query > show dbs admin 0.000GB config 0.000GB local 0.000GB > use users switched to db users > db.users.insert({name:"Foo Bar"}) WriteResult({ "nInserted" : 1 })
  • 12. MongoDB: Read Query > use users > db.users.find({}) { "_id" : ObjectId("5f5659472eef8cb6bf6a02f1"), "name" : "Foo Bar" }
  • 13. MongoDB: Update Query > db.users.update({}, {$set: {name:"Tanvir JurisTech"}}) WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 }) > db.users.find({}) { "_id" : ObjectId("5f5659472eef8cb6bf6a02f1"), "name" : "Tanvir JurisTech" }
  • 14. MongoDB: Delete Query > db.users.remove({name:"Tanvir JurisTech"}) WriteResult({ "nRemoved" : 1 }) > db.users.find({}) >
  • 15. MongoDB: Replica Set mongod --dbpath /data/db1 --port 27001 --replSet prod mongod --dbpath /data/db2 --port 27002 --replSet prod mongod --dbpath /data/db3 --port 27003 --replSet prod
  • 16. MongoDB: Replica Set > rs.initiate( { _id : "prod", members: [ { _id: 0, host: "127.0.0.1:27001" }, { _id: 1, host: "127.0.0.1:27002" } ] }) { "ok" : 1, "operationTime" : Timestamp(1599495296, 1), ... }
  • 17. MongoDB: Replica Set > mongo 127.0.0.1:27001 prod:PRIMARY> use messages switched to db messages prod:PRIMARY> db.messages.find({}) prod:PRIMARY> db.messages.insert({message:"Hello World!"}) WriteResult({ "nInserted" : 1 }) > mongo 127.0.0.1:27002 prod:SECONDARY> rs.slaveOk() prod:SECONDARY> use messages switched to db messages prod:SECONDARY> db.messages.find({}) { "_id" : ObjectId("5f565dcc832cf9e810aeea2d"), "message" : "Hello World!" }
  • 18. MongoDB: Replica Set > mongo 127.0.0.1:27001 prod:PRIMARY> rs.add({ _id: 2, host: "127.0.0.1:27003" } > prod:SECONDARY> rs.conf() { "_id" : "prod", "members" : [ { "host" : "127.0.0.1:27001", }, { "host" : "127.0.0.1:27002", }, { "host" : "127.0.0.1:27003", } ] }
  • 19. MongoDB: Replica Set > mongo 127.0.0.1:27001 prod:PRIMARY> 2020-09-08T00:28:05.646+0800 I NETWORK [thread1] trying reconnect to 127.0.0.1:27001 (127.0.0.1) failed 2020-09-08T00:28:05.646+0800 W NETWORK [thread1] Failed to connect to 127.0.0.1:27001, in(checking socket for error after poll), reason: Connection refused 2020-09-08T00:28:05.646+0800 I NETWORK [thread1] reconnect 127.0.0.1:27001 (127.0.0.1) failed failed # stop mongodb on port 27001 > mongo 127.0.0.1:27002 prod:SECONDARY> prod:SECONDARY> prod:PRIMARY> prod:PRIMARY> prod:PRIMARY> prod:PRIMARY>
  • 21. Why use DynamoDB ● Key-value based database at scale ● Serverless (managed by AWS) ● Auto scaling on enterprise level ● Read/Write capacity mode ● Realtime Trigger/Streams ● Priced on Read/Write operation* ● Automatic replication among AZ ● Handy HTTP API
  • 30. Q&A
  • 31. More references ● https://www.mongodb.com/nosql-explained/nosql-vs-sql ● https://www.featuredcustomers.com/vendor/amazon-dynamodb/customers ● https://bits.mdminhazulhaque.io/mongodb/mongodb-for-mysql-people.html ● https://bits.mdminhazulhaque.io/aws/aws-cli-cheatsheet.html#dynamodb ● https://aws.amazon.com/dynamodb/features/ ● https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GettingStar ted.PHP.html