NOSQL INTRODUCTION WITH MONGODB AND RUBY GEOFF LANE <GEOFF@ZORCHED.NET> @GEOFFLANE



Similar documents
.NET User Group Bern

Cloud Scale Distributed Data Storage. Jürmo Mehine

Structured Data Storage

Why NoSQL? Your database options in the new non- relational world IBM Cloudant 1

MongoDB. Or how I learned to stop worrying and love the database. Mathias Stearn. N*SQL Berlin October 22th, gen

Database Management System Choices. Introduction To Database Systems CSE 373 Spring 2013

Application of NoSQL Database in Web Crawling

The Quest for Extreme Scalability

An Open Source NoSQL solution for Internet Access Logs Analysis

NoSQL replacement for SQLite (for Beatstream) Antti-Jussi Kovalainen Seminar OHJ-1860: NoSQL databases

Slave. Master. Research Scholar, Bharathiar University

Document Oriented Database

Advanced Data Management Technologies

Lecture Data Warehouse Systems

MongoDB in the NoSQL and SQL world. Horst Rechner Berlin,

Understanding NoSQL Technologies on Windows Azure

Analytics March 2015 White paper. Why NoSQL? Your database options in the new non-relational world

L7_L10. MongoDB. Big Data and Analytics by Seema Acharya and Subhashini Chellappan Copyright 2015, WILEY INDIA PVT. LTD.

SQL VS. NO-SQL. Adapted Slides from Dr. Jennifer Widom from Stanford

NoSQL Database - mongodb

A COMPARATIVE STUDY OF NOSQL DATA STORAGE MODELS FOR BIG DATA

Applications for Big Data Analytics

Comparing SQL and NOSQL databases

extensible record stores document stores key-value stores Rick Cattel s clustering from Scalable SQL and NoSQL Data Stores SIGMOD Record, 2010

Crazy NoSQL Data Integration with Pentaho

Can the Elephants Handle the NoSQL Onslaught?

NoSQL in der Cloud Why? Andreas Hartmann


Challenges for Data Driven Systems

Comparison of the Frontier Distributed Database Caching System with NoSQL Databases

Big Data Solutions. Portal Development with MongoDB and Liferay. Solutions

MONGODB - THE NOSQL DATABASE

The NoSQL Ecosystem, Relaxed Consistency, and Snoop Dogg. Adam Marcus MIT CSAIL

Please ask questions! Have people used non-relational dbs before? MongoDB?

nosql and Non Relational Databases

Big Data Technologies Compared June 2014

Integrating Big Data into the Computing Curricula

HBase A Comprehensive Introduction. James Chin, Zikai Wang Monday, March 14, 2011 CS 227 (Topics in Database Management) CIT 367

NOSQL DATABASE SYSTEMS

NoSQL Databases. Nikos Parlavantzas

3 Case Studies of NoSQL and Java Apps in the Real World

Big Data Technologies. Prof. Dr. Uta Störl Hochschule Darmstadt Fachbereich Informatik Sommersemester 2015

An Approach to Implement Map Reduce with NoSQL Databases

Open Source Technologies on Microsoft Azure

Big Systems, Big Data

Overview of Databases On MacOS. Karl Kuehn Automation Engineer RethinkDB

Open source large scale distributed data management with Google s MapReduce and Bigtable

NoSQL - What we ve learned with mongodb. Paul Pedersen, Deputy CTO paul@10gen.com DAMA SF December 15, 2011

NoSQL: Going Beyond Structured Data and RDBMS

MongoDB. An introduction and performance analysis. Seminar Thesis

Making Sense ofnosql A GUIDE FOR MANAGERS AND THE REST OF US DAN MCCREARY MANNING ANN KELLY. Shelter Island

MongoDB Developer and Administrator Certification Course Agenda

Building Your First MongoDB Application

Evaluating NoSQL for Enterprise Applications. Dirk Bartels VP Strategy & Marketing

Preparing Your Data For Cloud

Frictionless Persistence in.net with MongoDB. Mogens Heller Grabe Trifork

MongoDB. The Definitive Guide to. The NoSQL Database for Cloud and Desktop Computing. Apress8. Eelco Plugge, Peter Membrey and Tim Hawkins

NoSQL Data Base Basics

The MongoDB Tutorial Introduction for MySQL Users. Stephane Combaudon April 1st, 2014

NoSQL Databases. Polyglot Persistence

@tobiastrelle. codecentric AG 1

How To Scale Out Of A Nosql Database

Sentimental Analysis using Hadoop Phase 2: Week 2

Benchmarking Couchbase Server for Interactive Applications. By Alexey Diomin and Kirill Grigorchuk

Lecture 21: NoSQL III. Monday, April 20, 2015

Perl & NoSQL Focus on MongoDB. Jean-Marie Gouarné jmgdoc@cpan.org

MEAP Edition Manning Early Access Program Neo4j in Action MEAP version 3

Not Relational Models For The Management of Large Amount of Astronomical Data. Bruno Martino (IASI/CNR), Memmo Federici (IAPS/INAF)

MongoDB: document-oriented database

Cloud Computing and Big Data What Technical Writers Need to Know

Introduction to NoSQL and MongoDB. Kathleen Durant Lesson 20 CS 3200 Northeastern University

BIG DATA TOOLS. Top 10 open source technologies for Big Data

Practical Cassandra. Vitalii

PHP and MongoDB Web Development Beginners Guide by Rubayeet Islam

Getting Started with MongoDB

Scaling with MongoDB. by Michael Schurter Scaling with MongoDB by Michael Schurter - OS Bridge,

MySQL és Hadoop mint Big Data platform (SQL + NoSQL = MySQL Cluster?!)

Data Modeling for Big Data

Dr. Chuck Cartledge. 15 Oct. 2015

Oracle s Big Data solutions. Roger Wullschleger. <Insert Picture Here>

Big Data in Test and Evaluation by Udaya Ranawake (HPCMP PETTT/Engility Corporation)

Performance Analysis for NoSQL and SQL

INTRODUCTION TO CASSANDRA

MongoDB Aggregation and Data Processing

MongoDB Aggregation and Data Processing Release 3.0.4

Search and Real-Time Analytics on Big Data

these three NoSQL databases because I wanted to see a the two different sides of the CAP

Understanding NoSQL on Microsoft Azure

Big Data. Facebook Wall Data using Graph API. Presented by: Prashant Patel Jaykrushna Patel

Introduction to Big Data Training

Microsoft Azure: Opção de Nuvem para Todo o Desenvolvedor. Danilo Bordini & Osvaldo Daibert

Introduction to NoSQL Databases. Tore Risch Information Technology Uppsala University

Brad Dayley. NoSQL with MongoDB

Composite Data Virtualization Composite Data Virtualization And NOSQL Data Stores

Transcription:

NOSQL INTRODUCTION WITH MONGODB AND RUBY GEOFF LANE <GEOFF@ZORCHED.NET> @GEOFFLANE

WHAT IS NOSQL? NON-RELATIONAL DATA STORAGE USUALLY SCHEMA-FREE ACCESS DATA WITHOUT SQL (THUS... NOSQL)

WIDE-COLUMN / TABULAR GOOGLE BIGTABLE MNESIA (ERLANG) HBASE / HADOOP

KEY/VALUE STORES GOOGLE BIGTABLE MEMCACHED REDIS CASSANDRA AMAZON SIMPLEDB MS AZURE DB

DOCUMENT STORE COUCHDB MONGODB APACHE JACKRABBIT

OBJECT DATABASES CACHÉ ZOPE DB4O

WHY NOT NOSQL?

YAGNI KISS WHATEVER...

IT S NOT EITHER/OR... IT S BOTH

ACID ATOMICITY (ALL OR NOTHING) CONSISTENCY (ENSURES THAT DB GOES FROM ONE CONSISTENT STATE TO ANOTHER) ISOLATION (TRANSACTION ISOLATION - OTHER TRANSACTIONS DON'T SEE CHANGED DATA) DURABILITY (RECOVER FROM FAILURES)

SQL SQL WORKS IT S WELL KNOWN A LOT OF FREAKING SMART PEOPLE BUILT AND OPTIMIZED ORACLE, POSTGRESQL, MYSQL, SQL SERVER, ETC

SQL 1 SELECT id,entityid,outcometype,type,name,shortdesc,longdesc,strategicframework,enabled 2 FROM OutcomeTemplates 3 WHERE o.id IN ( 4 SELECT atm.moduleid as id FROM ApplicationTemplateModules atm 5 WHERE atm.applicationtemplateid=? 6 ) 7 OR o.id IN ( 8 SELECT m.moduleid as id FROM EntityModules m 9 INNER JOIN Workset w 10 ON m.entityid = w.entityid 11 INNER JOIN ApplicationTemplate t 12 ON w.id = t.worksetid AND t.id=? 13 ) 14 AND o.enabled='y' 15

MULTI-OBJECT TRANSACTIONS EVERY NOW AND THEN YOU NEED TO UPDATE MORE THAN ONE OBJECT AT A TIME RIGHT?

POORLY SUITED FOR SPECIFIC DOMAINS THINGS REQUIRING MULTI-OBJECT TRANSACTIONS BANKING ACCOUNTING TRADITIONAL BI NIGHTLY-BATCH OLAP

WHY NOSQL?

IT S WELL SUITED FOR CERTAIN PROBLEMS CONTENT MANAGEMENT DOCUMENT MANAGEMENT LOG STORAGE UNSTRUCTURED DATA CACHING REAL-TIME ANALYTICS

HIGH-VOLUME / SCALABILITY WRITE INTENSIVE APPLICATIONS FIRE AND FORGET WRITES LOOSELY CONSISTENT OK EASY TO REPLICATE AND SHARD (MORE ON THAT LATER)

WHY MONGODB? I HAD TO CHOOSE ONE TO START WITH... IT WAS EASY TO INSTALL (IT S IN PORT AND BREW) IT SEEMS PRETTY POPULAR DOCUMENT-BASED SEEMS MORE GENERALLY USEFUL TO ME (MORE ON THIS...)

MONGODB SPECIFICS DOCUMENT STORE BSON (BINARY-JSON) INTERNAL DOCUMENT FORMAT NATIVE DRIVERS FOR LOTS OF LANGUAGES WRITTEN IN C++ USES GOOGLE V8 JAVASCRIPT ENGINE (FOR INTERNAL JAVASCRIPT EXECUTION, MAP-REDUCE, AND SHELL)

MONGODB LIMITS TRANSACTIONS LIMITED TO A SINGLE DOCUMENT 2GB DB SIZE ON 32BIT OS (VIRTUALLY UNLIMITED ON 64BIT OS) 4MB DOCUMENT SIZE LIMIT (WITH GRIDFS WORKAROUND) NON INDEXED SORTS HAVE TO FIT IN MEMORY

DATA TYPES JSON DATA TYPES: STRING, INTEGER, BOOLEAN, DOUBLE, NULL, ARRAY, AND OBJECT. ADDITIONAL DATA TYPES: DATE, OBJECT ID, BINARY DATA, REGULAR EXPRESSION, AND CODE

BASIC CONCEPTS MULTIPLE DATABASES PER SERVER COLLECTIONS DOCUMENTS EMBEDDED REFERENCED INDEXES SERVER SIDE JAVASCRIPT FUNCTIONS (STORED PROCEDURE-ESQE)

BASIC OPERATIONS

MONGODB WITH RUBY

GET STARTED WITH GEMS GEM INSTALL MONGO (PULLS BSON GEM AS WELL) GEM INSTALL BSON_EXT

RUBY DRIVER 1 require 'rubygems' # not necessary for Ruby 1.9 2 require 'mongo' 3 4 db = Mongo::Connection.new.db("mydb") 5 coll = db.collection("testcollection") 6 100.times { i coll.insert("i" => i) } 7 puts coll.count() 8 coll.find().each { row puts row.inspect } 9 coll.find("i" => 71).each { row puts row.inspect } 10 coll.find("i" => {"$gt" => 50}).each { row puts row } 11 coll.find({"name" => /^a/}) 12 13 14 search_string = "123" 15 coll.find({"name" => /#{search_string}/}) 16

MONGODB WITH RAILS

ADVANCED FEATURES

MAP REDUCE HTTP://WWW.ZORCHED.NET/2010/10/04/MONGODB-MAPREDUCE-FUNCTIONS-FOR-GROUPING/

JAVASCRIPT CONSOLE MAP REDUCE 1 var fmap = function () { 2 emit(this.metro.city, 1); 3 } 4 var fred = function (k, vals) { 5 var sum = 0; 6 for (var i in vals) { 7 sum += vals[i]; 8 } 9 return sum; 10 } 11 res = db.factories.mapreduce(fmap, fred) 12 db[res.result].find() 13 db[res.result].drop() 14

RUBY MAP REDUCE 1 require 'rubygems' 2 require 'mongo' 3 include Mongo 4 5 db = Connection.new.db('sample-db') 6 coll = db.collection('factories') 7 8 coll.remove 9 10 coll.insert( { :name => "Miller", :metro => { :city => "Milwaukee", :state => "WI" } } ) 11 coll.insert( { :name => "Lakefront", :metro => { :city: "Milwaukee", :state => "WI" } } ) 12 coll.insert( { :name => "Point", :metro => { :city => "Steven's Point", :state => "WI" } } ) 13 coll.insert( { :name => "Pabst", :metro => { :city => "Milwaukee", :state => "WI" } } ) 14 coll.insert( { :name => "Blatz", :metro => { :city => "Milwaukee", :state => "WI" } } ) 15 coll.insert( { :name => "Coors", :metro => { :city => "Golden Springs", :state => "CO" } } ) 16 17 puts "There are #{coll.count()} factories. Here they are:" 18 coll.find().each { doc puts doc.inspect } 19 map_function = "function () { emit(this.metro.city, this.name); }" 20 reduce_function = "function (k, vals) { return vals.join(","); }" 21 coll.map_reduce(map_function, reduce_function).each { r puts r.inspect } 22 23

REPLICATION

SHARDING (HORIZONTAL PARTIONING)

WHAT DID I SKIP? LOT S OF THINGS... INDEXING GRIDFS SERVER-SIDE FUNCTIONS SYSTEM MANAGEMENT STUFF (BACKUPS, ETC)