MongoDB and DigitalOcean Automation with Cloud Manager
-
Upload
jay-gordon -
Category
Technology
-
view
218 -
download
1
Transcript of MongoDB and DigitalOcean Automation with Cloud Manager
Jay GordonDeveloper Advocate - NYC@jaydestro
{ "name" : "Jay Gordon", "what" : Dev Advocate, "former roles" : [ { "title" : "SysAdmin", "company": "BuzzFeed" }, { "title" : "Platform Engineer", "company" : "DigitalOcean" }
Area Man Talks About Software
Jay GordonDeveloper Advocate - NYC@jaydestro
GET TO THE POINT.
Topics:- Introducing MongoDB- What’s under the hood?- What makes up MongoDB?- How can I configure MongoDB with DO?
Jay GordonDeveloper Advocate - NYC@jaydestro
GET TO THE POINT.Not gonna:- Use a silly analogy about MongoDB and my favorite sports personality.- Badmouth other DBs.- Code live.
The Modern App
• High Concurrency• High Throughput• Low Latency• Real-time analytics • Cost Effective• Zero downtime
Let’s Meet MongoDB
MongoDB is an open-source, distributed document database that provides high performance, high availability, and scaling.
Let’s Meet MongoDBMongoDB was written to make it simple to store data.
No need for rigid schemas.model your data based on your
changing needs
Let’s Meet MongoDB- MongoDB was built for developers to get started
quickly!- Written in C++, C and JavaScript.- Source and binary packages available for download
on mongodb.com/download- Runs on Windows, Linux and MacOS- Affero GPL License
Your data is stored in JSON Style
game {player_one: PlayerID,player_two: PlayerID,moves [ { token: <moveToken1>, ts: timestamp1 }, { token:
<moveToken2>, ts: timestamp2 ... ],game_parameters: { param1 : v, param2 : v, ... },start_time: ts,end_time: ts,state: <state>, // in_play, mate, resign, draw
winner: W || B || D}
Documents are Rich Data Structures{ first_name: ‘Paul’, surname: ‘Miller’, cell: 447557505611, city: ‘London’, location: [45.123,47.232], Profession: [‘banking’, ‘finance’, ‘trader’], cars: [ { model: ‘Bentley’, year: 1973, value: 100000, … }, { model: ‘Rolls Royce’, year: 1965, value: 330000, … } ]}
Fields can contain an array of sub-documents
Typed field values
Fields can contain arrays
String
Number
Geo-Location
Fields
Fields can be indexed and queried at any level
ORM layer removed – Data is already an object!
Documents are Flexible
{ sku: ‘PAINTZXC123’, product_name: ‘Acme Paint’, color: [‘Red’, ‘Green’], size_oz: [8, 32], finish: [‘satin’, ‘eggshell’]
}
{ sku: ‘TSHRTASD43546’, product_name: ‘T-shirt’, size: [‘S’, ‘M’, ‘L’, ‘XL’], color: [‘Heather Gray’ … ], material: ‘100% cotton’, wash: ‘cold’, dry: ‘tumble dry low’}
{ sku: ‘CYCLBVCX6543’, product_name: ‘Mountain Bike’, brake_style: ‘mechanical disc’, color: ‘grey’, frame_material: ‘aluminum’, no_speeds: 21, package_height: ‘7.5x32.9x55’, weight_lbs: 44.05, suspension_type: ‘dual’, wheel_size_in: 26}
Documents in the same product catalog collection in MongoDB
BSON Storage
- Binary encoding JSON data representation!
- Easier to transfer than text files- Lightweight, transversable, efficient
Expressive Query Language
Rich Queries Find Paul’s carsFind everybody in London with a car between 1970 and 1980
Geospatial Find all of the car owners within 5km of Trafalgar Sq.
Text Search Find all the cars described as having leather seats
Aggregation Calculate the average value of Paul’s car collection
Map Reduce What is the ownership pattern of colors by geography over time (is purple trending in China?)
MongoDB 3.4 – Multi-Model Database
DocumentRich JSON Data Structures
Flexible SchemaGlobal Scale
RelationalLeft-Outer Join
ViewsSchema Validation
Key/ValueHorizontal Scale
In-Memory
SearchText SearchMultiple LanguagesFaceted Search
BinariesFiles & MetadataEncrypted
GraphGraph & HierarchicalRecursive Lookups
GeoSpatialGeoJSON2D & 2DSphere
Aggregation PipelineThe aggregation pipeline is a framework for data aggregation modeled on the concept of data processing pipelines. Documents enter a multi-stage pipeline that transforms the documents into aggregated results.
• Primary• Secondary• Votes and Elections• Arbiters• Hidden, delayed secondaries• Config Servers
What Components Make Up MongoDB?
Helping you deploy in any environment
Control
Cloud Manager Ops Manager MongoDB Atlasdata: on-prem or cloudops: on-prem or cloud
data: on-prem or cloudops: cloud
Fully Managed Cloud
Convenience
Lots of Work, A New Database!
PATCHES
UPGRADES
SECURITY
BACKUPS
RECOVERY
99.999% UPTIME
UPSCALE
DOWNSCALE
Example of Web App on DO Network
Cloud Manager data: on-prem or cloud
ops: cloud
MongoDB – Three droplet cluster.
NodeJS– Two droplet web app.
DigitalOcean - Load Balancer
Configure Private IP Networkroot@mongodb-1gb-nyc2-01:~# /sbin/ifconfig eth1 | grep 'inet addr:' | cut -d: -f2| cut -d' ' -f110.128.32.63
root@mongodb-1gb-nyc2-02:~# /sbin/ifconfig eth1 | grep 'inet addr:' | cut -d: -f2| cut -d' ' -f110.128.32.64
root@mongodb-1gb-nyc2-03:~# /sbin/ifconfig eth1 | grep 'inet addr:' | cut -d: -f2| cut -d' ' -f110.128.32.66
Hosts file or DNSroot@mongodb-1gb-nyc2-01:~# hostname -fmongodb-1gb-nyc2-01
root@mongodb-1gb-nyc2-02:~# hostname -fmongodb-1gb-nyc2-02
root@mongodb-1gb-nyc2-03:~# hostname -fmongodb-1gb-nyc2-03
Create hosts file entry for each site and then enter it into each server’s /etc/hosts/ file:
10.128.32.63 mongodb-1gb-nyc2-0110.128.32.64 mongodb-1gb-nyc2-0210.128.32.66 mongodb-1gb-nyc2-03
Continuous Backup / Point-in-time Restore Under the hood
● MongoDB Cloud Manager continuously backs up your data,
ensuring your backups are typically just a few seconds behind the
operational system
● Point-in-time backup of replica sets and consistent, cluster-wide
snapshots of sharded clusters. With MongoDB Cloud Manager,
you can easily and safely restore to precisely the moment you
need
● Compression and block-level deduplication technology keeps
your backup processes as efficient as possible
● Backups are securely stored in North America and Europe. For
location flexibility of your backup data, you can utilize MongoDB’s
mongodump / mongorestore tools
Operations Burden
PATCHES
UPGRADES
SECURITY
BACKUPS
RECOVERY
99.999% UPTIME
UPSCALE
DOWNSCALE
PERFORMANCE
UAT
STAGING
MONITORING
ALERTS
PROVISION
CONFIGURE
INSTALL
Join us at MongoDB World 2017June 20-21Chicago, IL Bringing together 3000 developers, architects, IT professionals and executive decision makers, MongoDB World is the foremost conference dedicated to the database for giant ideas.
www.mongodb.com/events/mongodb-world-2017 25% Discount with JayGordon25