Click here to load reader

S01 e00 einfuehrung-in_mongodb

  • View
    499

  • Download
    0

Embed Size (px)

Text of S01 e00 einfuehrung-in_mongodb

S01E00 Einfhrung in die Webinarserie

Staffel 1: MongoDB Applikationsentwicklung

Marc [email protected]

#MongoDBBasicsEinfhrung in MongoDB Back to Basics

1

Fragen im Chat oder via Twitter: #MonogDBBasicsDas Webinar ist auf deutsch, die Folien sind in englischDie Serie wird ist in zwei Staffeln gegliedertApplikationsentwicklung mit MongoDBMongoDB in produktion / operationsDas Webinar wird aufgezeichnet

Generelle Informationen

nr.About the Webinar Series Data ModelQuery ModelScalabilityAvailabilityDeployment ArchitecturesPerformanceNext Session

Introduction

nr.

3

Split into 2 seasonsApplication Development (4 parts)Schema DesignInteracting with the database query and update operatorsIndexingAggregation & ReportingOperations (3 parts)Deployment scale out and high availabilityMonitoring and performance tuningBackup and recoverySeries Outline & Approach

nr.Content Management SystemWill utilise :Query & update operatorsAggregation FrameworkGeospatial queriesPre Aggregated reports for fast analyticsPolymorphic documentsAnd moreTake away frameworkAn approach that you can reuse in your own applications

Application Overview

nr.Virtual Genius Bar

Use the chat to post questions

EMEA Solution Architecture team are on hand

Make use of them during the sessions!!!Q & A

nr.MongoDB

Who is in the house7

Operational Database

nr.

8

Document Data ModelRelational - Tables

{ first_name: Paul, surname: Miller, city: London, location: {type: Point, coordinates :[-0.128, 51.507]}, cars: [ { model: Bentley, year: 1973, value: 100000, }, { model: Rolls Royce, year: 1965, value: 330000, } }}Document - Collections

nr.

9

Document ModelAgility and flexibility dynamic schemaData models can evolve easilyCompanies can adapt to changes quickly

Intuitive, natural data representationRemove impedance mismatchMany types of applications are a good fit

Reduces the need for joins, disk seeksProgramming is more simplePerformance can be delivered at scale

nr.

10

Simplify development

nr.Simplify development

nr.Rich database interaction

nr.

13

Query Model

ShellCommand-line shell for interacting directly with databaseShell and DriversDriversDrivers for most popular programming languages and frameworks

> db.collection.insert({company:10gen, product:MongoDB})> > db.collection.findOne(){_id: ObjectId(5106c1c2fc629bfe52792e86),company: 10genproduct: MongoDB}JavaPython

Perl

RubyHaskell

JavaScript

nr.

15

MongoDB is full featuredQueriesFind Pauls carsFind everybody in London with a car built between 1970 and 1980GeospatialFind all of the car owners within 5km of Trafalgar Sq.Text SearchFind all the cars described as having leather seatsAggregationCalculate the average value of Pauls car collectionMap ReduceWhat is the ownership pattern of colors by geography over time? (is purple trending up in China?){ first_name: Paul, surname: Miller, city: London, location: {type: Point, coordinates :[-0.128, 51.507]}, cars: [ { model: Bentley, year: 1973, value: 100000, }, { model: Rolls Royce, year: 1965, value: 330000, } }}

nr.Query ExampleRich QueriesFind Pauls carsFind everybody in London with a car built between 1970 and 1980db.cars.find({first_name: Paul})

db.cars.find({city: London, cars.year" : {$gte : 1970, $lte : 1980}})

{ first_name: Paul, surname: Miller, city: London, location: {type: Point, coordinates :[-0.128, 51.507]}, cars: [ { model: Bentley, year: 1973, value: 100000, }, { model: Rolls Royce, year: 1965, value: 330000, } }}

nr.Geo Spatial Exampledb.cars.find( { location: { $near : { $geometry : { type: 'Point' , coordinates :[-0.128, 51.507] } }, $maxDistance :5000 } } )

GeospatialFind all of the car owners within 5km of Trafalgar Sq.{ first_name: Paul, surname: Miller, city: London, location: {type: Point, coordinates :[-0.128, 51.507]}, cars: [ { model: Bentley, year: 1973, value: 100000, }, { model: Rolls Royce, year: 1965, value: 330000, } }}

nr.Aggregation Framework Exampledb.cars.aggregate( [

{$match : {"first_name" : "Paul"}}, {$project : {"first_name":1,"cars":1}},{$unwind : "$cars"},{ $group : {_id:"$first_name", average : {$avg : "$cars.value"}}} ])

{ "_id" : "Paul", "average" : 215000 }

AggregationCalculate the average value of Pauls car collection{ first_name: Paul, surname: Miller, city: London, location: {type: Point, coordinates :[-0.128, 51.507]}, cars: [ { model: Bentley, year: 1973, value: 100000, }, { model: Rolls Royce, year: 1965, value: 330000, } }}

nr.Scalability

Automatic ShardingThree types of sharding: hash-based, range-based, tag-awareIncrease or decrease capacity as you goAutomatic balancing

nr.Query RoutingMultiple query optimization modelsEach sharding option appropriate for different apps

nr.Availability

High Availability Ensure application availability during many types of failures

Disaster Recovery Address the RTO and RPO goals for business continuity

Maintenance Perform upgrades and other maintenance operations with no application downtime

Availability Considerations

nr.Recovery time objective and recoverz point objective24

Replica SetsReplica Set two or more copiesSelf-healing shardAddresses many concerns:High AvailabilityDisaster RecoveryMaintenance

nr.Replica Set BenefitsBusiness NeedsReplica Set BenefitsHigh AvailabilityAutomated failover Disaster RecoveryHot backups offsiteMaintenanceRolling upgradesLow LatencyLocate data near usersWorkload IsolationRead from non-primary replicasData PrivacyRestrict data to physical locationData ConsistencyTunable Consistency

nr.Performance

Better Data LocalityPerformanceIn-Memory CachingIn-Place Updates

nr.Document ModelSimplify developmentSimplify scale outImprove performance

MongoDBRich general purpose databaseBuilt in High Availability and FailoverBuilt in scale out

Summary

nr.Marc SchweringSchema design for the CMS applicationCollectionsDesign decisions

Application architectureExample technologiesRESTful interfaceWeve chosen python for the examples

Code Examples

Next Week 7th May

nr.

31