2012-01-31 nosql in .net
Post on 27-Jan-2015
106 Views
Preview:
DESCRIPTION
TRANSCRIPT
Veranstalter: Partner:
30.-31. JAN. 2012, MÜNCHEN
VISUAL STUDIO FÜR WINDOWS-ENTWICKLER
31.01.2012 Dipl.-Inf. (FH) Johannes Hoppe
in .NET mit RavenDB und MongoDB
Not only SQL
01
2002 2004 2006 2008 2010 2012
Daten
Trend 1: wachsende Datenmengen
Trend 2: mehr Vernetzung (“web 2.0”)
Trend 3: mehr Individualisierung (weniger Struktur)
Scale-up Vertikale Skalierung
Server auf mehr Leistungsfähigkeit trimmen
Scale-out horizontale Skalierung
Einfügen von Nodes (Rechnerknoten)
verteilte und horizontale Skalierbarkeit
kein relationales Datenmodell (kein SQL)
schemafrei / schwache Schemarestriktionen
anderes Konsistenzmodell
Schemafrei kein ALTER TABLE
kein Wartungsfenster *
Datenversionierung im Code!
* morgens ausschlafen
Anforderungen
an ein verteiltes System
Consistency Konsistenz
AvailabilityVerfügbarkeit
Partition
Tolerance Ausfalltoleranz
CAP Theorem › 2000: E. Brewer, N. Lynch
› You can satisfy
at most 2 out of the 3 requirements
Consistency › The system is in a consistent state after an operation
› All clients see the same data
› Strong consistency (ACID)
vs. eventual consistency (BASE)
ACID: Atomicity, Consistency, Isolation and Durability
BASE: Basically Available, Soft state, Eventually consistent
Availability › System is “always on”, no downtime
› Node failure tolerance
– all clients can find some available replica
› Software/hardware upgrade tolerance
Partition tolerance › System continues to function even when
split into disconnected subsets (network disruption)
› Not only for reads, but writes as well
“Drum prüfe,
wer sich ewig bindet.” Friedrich Schiller
Klassifizierung › Key-Value stores
› Document stores MongoDB & RavenDB
› Wide Column stores
› Graph-Datenbanken
› und viele weitere
Tabellen Dokumente
02
https://webnote.codeplex.com
MongoDB
03
NoSQL
MongoDB Quick Reference Cards
http://www.10gen.com/reference
und zum Mitnehmen!
“Deployment” › Standardverzeichnis erstellen:
c:\data\db
› Server-Start: mongod.exe
› Shell: mongo.exe
BSON Master/Slave
JavaScript C# Driver
Sharding GNU AGPL
JSON BSON
All JSON documents are stored in a binary
format called BSON. BSON supports a
richer set of types than JSON. http://bsonspec.org
CRUD – Create
In der Shell
› use WebNote
› db.Notes.save( {Title: 'Mittag',
Message: 'nicht vergessen' });
So funktioniert der Befehl
› db.Notes.save
CRUD – Read Queries werden ebenso im Dokument-Stil spezifiziert
› db.Notes.find();
› db.Notes.find({ Title: /Test/i });
› db.Notes.find({ "Categories.Color": "red"}).limit(1);
CRUD – Update
› db.Notes.update({Title: 'Test'}, {'$set': {Categories: []}});
› db.Notes.update({Title: 'Test'},
{'$push': {Categories: { Color: 'Red' }}});
CRUD – Delete
› db.dropDatabase();
› db.Notes.drop();
› db.Notes.remove();
“Map Reduce is the Uzi of aggregation
tools. Everything described with count,
distinct and group can be done with
MapReduce, and more.” Kristina Chadorow, Michael Dirolf in MongoDB – The Definitive Guide
RavenDB
04
NoSQL
Raven Db Documentation
http://ravendb.net/docs
JSON * Transaktional
LINQ Lucene
100% .NET AGPL / dual
* Newtonsoft.Json.dll JSON DOM (Raven.Json)
“Deployment” › Via NuGet
› Raven.Server.exe.config anpassen It’s safe by default!
› Server-Start: Raven.Server.exe
Designed to “just work” › Fluent API
› Unit of Work Pattern
› Extensible – Plugin Support
Safe by default › praktische defaults
› z.B. Limited page size – kein unabsichtliches SELECT *
› ACID
› Client / Server
› Cross shard
Indexe › Als Linq Queries definiert
› Indiziert mit Lucene .NET
APIs › Native .NET Client API
› HTTP API (Pseudo REST)
HTTP API › Caching
› E-Tags
› Lucene Queries möglich
C:\>curl -X GET http://localhost:8080/docs/Categories/1 -i HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 ETag: 00000000-0000-0200-0000-000000000004 { "Name" : "Normal Importance", "Color" : "green" }
Lucene Style Queries
Lucene Style var notes = session.Advanced .LuceneQuery<Note>() .Where(“Category:Important") .ToArray();
Classic Linq Style var notes = session .Query<Note>() .Where(n => n.Category == “Important") .ToArray();
NoSQL: Einstieg in die Welt nicht-
relationaler Web 2.0 Datenbanken
MongoDB:
The Definitive Guide
MongoDB in Action RavenDB Mythology Documentation https://s3.amazonaws.com/
daily-builds/RavenDBMythology-11.pdf
Veranstalter: Partner:
30.-31. JAN. 2012, MÜNCHEN
VISUAL STUDIO FÜR WINDOWS-ENTWICKLER
FRAGEN?
Veranstalter: Partner:
Wir sehen uns wieder!
Advanced Developers Conference C++
3. – 4. Mai 2012, Zugspitzland
Development for C++ Professionals!
www.adcpp.de
SharePoint Konferenz in Wien
19. – 20. Juni 2012, Wien
ppedv-Konferenz in Kooperation mit
Microsoft Österreich
www.SharePointKonferenz.at
Veranstalter: Partner:
30.-31. JAN. 2012, MÜNCHEN
VISUAL STUDIO FÜR WINDOWS-ENTWICKLER
Hat Ihnen mein Vortrag gefallen?
Ich freue mich auf Ihr Feedback!
Veranstalter: Partner:
30.-31. JAN. 2012, MÜNCHEN
VISUAL STUDIO FÜR WINDOWS-ENTWICKLER
Vielen Dank Johannes Hoppe
Bildnachweise
Ausgewählter Ordner © Spectral-Design – Fotolia.com
Warnhinweis-Schild © Sascha Tiebel – Fotolia.com
Liste abhaken © Dirk Schumann – Fotolia.com
Stressed businessman © Selecstock – Fotolia.com
top related