• No results found

Introduction to NoSQL Databases. Tore Risch Information Technology Uppsala University

N/A
N/A
Protected

Academic year: 2021

Share "Introduction to NoSQL Databases. Tore Risch Information Technology Uppsala University"

Copied!
17
0
0

Loading.... (view fulltext now)

Full text

(1)

Introduction to

NoSQL Databases

Tore Risch

Information Technology

Uppsala University

2013-03-05

(2)

Tore Risch

Uppsala University, Sweden

Evolution of

DBMS technology

1960 1970 1980 1990 2000

Files IMS RDB Object Stores ORDB CODASYL Databases Web sources Mediators 0011001.. Streaming data DSMS Distributed databases UDBL Cloud databases 2010 MapReduce BIG table NoSQL SQL NoSQL SQL+ SQL+ New QL SQL-NoSQL HIVE SQL-SQL SQL/MapReduce

(3)

Tore Risch

Uppsala University, Sweden UDBL

Kinds of

DBMS support

Query (SQL) No Query (NoSQL)

Simple Data Complex data File systems (scalable) Storage managers Relational DBMSs Object Stores Object-Relational DBMSs

(4)

Tore Risch

Uppsala University, Sweden UDBL

Classification of

Modern Database applications

Complex Queries SQL, New QL

No Queries

NoSQL

Simple Data Complex data Simple Queries

SQL-Business operations Business analytics Personal db

Text, data logs

Simple computations Web documents CAD system Complex computations Web surfing Multimedia search Custom Datatypes Data streams Web analytics

(5)

Tore Risch

Uppsala University, Sweden UDBL

Kind of

Database support

Complex Queries SQL, New QL No Queries NoSQL

Simple Data Complex data Simple Queries SQL-File systems Content Mgmt. Syst. Object Stores Google BigTable Yahoo Hadoop MongoDB,CouchDB Google App Engine

(GQL)

Amazon SimpleDB Microsoft Azure

Google search engine Facebook HIVE

Relational DBMS

Object-Relational DBMS

Data Stream Mgmt. Syst. Virtuoso, Neo4J, Amos II

(6)

What is a NoSQL Database?

• A key/value store

Basic index manager, no complete query language

– E.g. Google BigTable, Amazon Dynamo

• A web document database

For web documents, not for small business transactions

– E.g. MongoDB, CouchDB

• A DBMS with a limited query language

Provides for high volume small business transactions

– Sometimes called cloud databases

– E.g. Google App Engine, Microsoft Azure, Amazon SimpleDB, Facebook HIVE

(7)

What is a NoSQL Database?

• A DBMS where mapreduce is used instead of queries

Manual programs to iterate over entire data sets

– E.g. Hadoop, MongoDB, CouchDB, Dynamo

• A mapreduce engine with a limited query language on

top:

HIVE on top of Hadoop provides HIVEQL

– Provides non-procedural data analythics (select from groupby) without detailed programming

– Executed in batch as paralle Hadoop jobs

• A DBMS with a new query language for new applications

– Streambase, Virtuoso, Neo4J, Amos II

• Other non-relational databases

(8)

NoSQL Characteristics

• Highly distributed and parallel architectures – Typically runs on data centers

– This is similar to parallel databases!

• Highly scalable systems by compromised consistency – No 2-phase commit as in distributed databases – Eventual consistency

• Or perhaps never consistency

• Similar options available in modern DBMSs too

– Puts burden on programmer to handle consistency!

• Race conditions • Recovery

 Customized implementation of transacations

(9)

NoSQL Characteristics

• New query languages for new applications – SQL- for cloud databases

• Most simple web applications do not need full SQL • Simple SQL permits high scalability

• Familiar model

• Full SQL too complex for new systems – Graph query languages

• SPARQL for RDF – RDF data model

– For searching linked data (http://linkeddata.org/) – Stream query languages

• CQL

– Variant of SQL for streams • SCSQL (UU)

(10)

MapReduce

Parallel batch processing using mapreduce

– Many NoSQL databases uses mapreduce for parallel batch processing of data stored in data centers

– Highly scalable implementation of

• parallell batch processing • of same (e.g. Java) program

• over large amounts of data stored in different files • Based on a scalable file system (e.g. HDFS)

• The mapreduce function:

– Applies a (costly) user function mapper producing key/value pairs in parallel on many nodes accessing files in a cluster – Applies a user aggregate function on the key/value pairs

produced by the mapper

– Very similar to GROUP BY in SQL – Read reference article on MapReduce

(11)

Mapreduce code

function map(String name, String document):

// name: document name, i.e. HDFS file contents

// document: document contents, parsed HDFS file tokens // Can make own parser as preprocessor

for each word w in document: emit (w, 1)

function reduce(String word, Iterator partialCounts):

// word: a word

// partialCounts: a list of aggregated partial counts

sum = 0;

for each pc in partialCounts: sum += ParseInt(pc);

(12)

Mapreduce manager

architecture

(13)

Mapreduce stages

• Input reader

– System component that reads files from scalable file system (e.g. HDFS) and sends to map functions applied in parallell

• Map function

– Applied in parallel on many different files – Parsers input file data from HDFS

– Does some (expensive) computation – Emits key value pairs as result

– Result stored by MapReduce system as file

• Partion function (optional)

– Partitions output key/value pairs fro map function into groups of key/value pairs to be reduced in parallel

– Usually hash partitioning

• Reduce function

– Iterates over set of key/value pairs to produced a reduced set of key value pairs stored in the file system

(14)

Mapreduce

Data file Data file Data file Data file Data file Data file Map Map Map Map Map Map Reduce Reduce Partition Partition Partition Partition Partition Partition Output Writer Result file Reduce File I/O

(15)
(16)

Wordcount in Hive

FROM (

MAP doctext USING 'python wc_mapper.py'

AS (word, cnt)

FROM docs

CLUSTER BY word

)

REDUCE word, cnt USING

'pythonwc_reduce.py';

(17)

Architecture

• Metastore: stores system catalog

• Driver: manages life cycle of HiveQL query, session handles

and session statistics

• Query compiler: Compiles HiveQL into a distributed execution

plan of map/reduce tasks

• Execution engines: The component executes the execution

plan in proper dependency order; interacts with Hadoop

• HiveServer: provides JDBC/ODBC drivers and other

interfaces for integrating other applications.

• Client API components: CLI, web interface, jdbc/odbc API

• Extensibility interface include SerDe (parse/print), User

References

Related documents

Professional broadcast automation platform featuring playout and ingest with Blackmagic Professional broadcast automation platform featuring playout and ingest with Blackmagic

We have found that bank type matters as they have different role in bank networks, the Brazilian bank network is characterized by money centers, in which large banks are

@property (weak, nonatomic) IBOutlet UIImageView *board;. @property (weak, nonatomic) IBOutlet UILabel

Most notably students’ models of software engineering processes became richer as indicated by significantly more responses to question 2, “What software engineering processes do

In addition to the lower probability of receiving Social Security benefits and an employer-sponsored pension, this research found that never married people also possessed

College of Arts Crafts and Design Konstfack Glass Stockholm Urban Glass New York City, USA. Urban Glass Abroad, Codligiocco Italy Pittsburgh

Respon siswa terhadap pembelajaran dengan bantuan modul praktikum berbasis model PBI dengan scientific approach yang diterapkan pada mata pelajaran instalasi

The key maintained assumption in this analysis is that municipal green procurement policies in far-away cities increase the supply of LEED Accredited Professionals in nearby