no sql database

32
No SQL Database PRODI TEKNIK INFORMATIKA DAN KOMPUTER UNIVERSITAS NEGERI MAKASSAR 2012 BY NUR HIDAYA BUKHARI 102904037

Upload: charo

Post on 12-Jan-2016

209 views

Category:

Documents


30 download

DESCRIPTION

No SQL Database. BY NUR HIDAYA BUKHARI 102904037. PRODI TEKNIK INFORMATIKA DAN KOMPUTER UNIVERSITAS NEGERI MAKASSAR 2012. Outlines. Apa itu No Sql Database ? Sejarah dan perkembangan Mengapa Menggunakan No Sql Database Klasifikasi No SQL Database Perbedaan SQL dan No SQL Database Etc. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: No SQL Database

No SQL Database

PRODI TEKNIK INFORMATIKA DAN KOMPUTERUNIVERSITAS NEGERI MAKASSAR

2012

BYNUR HIDAYA BUKHARI102904037

Page 2: No SQL Database

Outlines

Apa itu No Sql Database ? Sejarah dan perkembangan Mengapa Menggunakan No Sql Database Klasifikasi No SQL Database Perbedaan SQL dan No SQL Database Etc.

Page 3: No SQL Database

Apa Itu No SQL Database

Dapat juga disebut “Not Only SQL” adalah sistem manajemen database alternatif yang berbeda jauh dari model tradisional dari sistem manajemen database relasional (RDBMS) ataupun sistem manajemen database berbasis object(ODBMS).

Penyimpanan data ini tidak memerlukan skema tabel tetap, biasanya menghindari joins operation dan skala horizontal, merupakan open source, cara penyimpanannya- pun tidak memerlukan inisialisasi terlebih dahulu.

Dalam arti luas,cara penyimpanan data yang tidak menggunakan sql atau database relasional untuk menyimpan data.

Di Populerkan oleh website besar seperti Google dan Facebook.

Page 4: No SQL Database

Sejarah dan Perkembangan NoSql

Coined in 1998 by Carlos Strozzi to describe a database that did not expose a SQL interface

In 2008, Eric Evans reintroduced the term to describe the growing non-RDBMS movement

Popularized by large web sites such as Google, Facebook and Digg

http://en.wikipedia.org/wiki/NoSQL_%28RDBMS%29

Page 5: No SQL Database

Sejarah dan Perkembangan NoSql

- Perkembangan dari situs media sosial (Facebook, Twitter) dengan kebutuhan data yang besar.

- Kebutuhan akan penyimpanan data yang besar di situs web besar seperti Google, Yahoo ( Banyak data yang tidak file ).

- Munculnya solusi berbasis cloud seperti Amazon S3 (solusi penyimpanan yang sederhana)

- Untuk tipe data dinamis dengan seringnya perubahan skema.- Komunitas open-source.

Page 6: No SQL Database

Sejarah dan Perkembangan NoSql

Ada tiga bahasan besar yang mendorong perkembangan NoSql :– BigTable (Google)– Dynamo (Amazon)– CAP Theorem

Page 7: No SQL Database

No Sql Database Karakteristik

Large data volumes– Google’s “big data”

Queries need to return answers quickly Mostly query, few updates Asynchronous Inserts & Updates Schema-less ACID transaction properties are not needed BASE transaction CAP Theorem Open source development

Page 8: No SQL Database

Transactions – ACID PropertiesTransactions – ACID Properties

AAtomic – All of the work in a transaction completes (commit) tomic – All of the work in a transaction completes (commit) or none of it completesor none of it completes

CConsistent – A transaction transforms the database from onsistent – A transaction transforms the database from one consistent state to another consistent state. one consistent state to another consistent state. Consistency is defined in terms of constraints.Consistency is defined in terms of constraints.

IIsolated – The results of any changes made during a solated – The results of any changes made during a transaction are not visible until the transaction has transaction are not visible until the transaction has committed.committed.

DDurable – The results of a committed transaction survive urable – The results of a committed transaction survive failuresfailures

Page 9: No SQL Database

BASE TransactionsBASE Transactions

Acronym contrived to be the opposite of ACIDAcronym contrived to be the opposite of ACID– BBasically asically AAvailable, vailable, – SSoft state,oft state,– EEventually Consistentventually Consistent

CharacteristicsCharacteristics– Weak consistency – stale data OKWeak consistency – stale data OK– Availability firstAvailability first– Best effortBest effort– Approximate answers OKApproximate answers OK– Aggressive (optimistic)Aggressive (optimistic)– Simpler and fasterSimpler and faster

Page 10: No SQL Database

Keuntungan

Cheap, easy to implement (open source) Data are replicated to multiple nodes (therefore identical and

fault-tolerant) and can be partitioned– Down nodes easily replaced– No single point of failure

Easy to distribute Don't require a schema Can scale up and down Relax the data consistency requirement (CAP)

Page 11: No SQL Database

NoSQL ProductsNoSQL Products

Cassandra CouchDB Hadoop & Hbase MongoDB StupidDB Etc.

Page 12: No SQL Database

Perbandingan Beberapa Aplikasi NoSQL DataBase

Page 13: No SQL Database

Perbandingan Beberapa Aplikasi NoSQL DataBase

Page 14: No SQL Database

Perbandingan Beberapa Aplikasi NoSQL DataBase

Page 15: No SQL Database

Klasifikasi No Sql Database

Discussing NoSQL databases is complicated because there are a variety of types:

Column Store – Each storage block contains data from only one column

Document Store – stores documents made up of tagged elements

Key-Value Store – Hash table of keys

Page 16: No SQL Database

Klasifikasi No Sql Database

XML Databases Graph Databases Codasyl Databases Object Oriented Databases Distributed Peer Stores

Page 17: No SQL Database

2 Garis Besar NoSql

NoSQL solutions fall into two major areas:– Key/Value or ‘the big hash table’.

Amazon S3 (Dynamo) Voldemort Scalaris

– Schema-less which comes in multiple flavors, column-based, document-based or graph-based.

Cassandra (column-based) CouchDB (document-based) Neo4J (graph-based) HBase (column-based)

Page 18: No SQL Database

Key/Value

Pros:– very fast– very scalable– simple model– able to distribute horizontally

Cons: - many data structures (objects) can't be easily modeled

as key value pairs

Page 19: No SQL Database

Schema-Less

Pros:- Schema-less data model is richer than key/value pairs- eventual consistency- many are distributed- still provide excellent performance and scalability

Cons: - typically no ACID transactions or joins

Page 20: No SQL Database

Perbedaan Dengan Database Relasional

Relational – Insert data

$sql = "INSERT INTO `$tbl` SET `login` = 'coba1', `password` = '0c50a2d250b30bf01aa0fabf782cb448', `email` = '[email protected]'"; mysql_query($sql);

No Sql (MongoDB)– Insert data

 db.mahasiswa.save({nama:’FadliSaldi’,NPM:’18109015′,jurusan:’Sistem Informasi’,Fakultas:’Ilmu Komputer’})

Page 21: No SQL Database

Perbedaan Dengan Database Relasional

SQL DatabasesSQL Databases– Predefined SchemaPredefined Schema– Standard definition and interface languageStandard definition and interface language– Tight consistencyTight consistency– Well defined semanticsWell defined semantics

NoSQL DatabaseNoSQL Database– No predefined SchemaNo predefined Schema– Per-product definition and interface languagePer-product definition and interface language– Getting an answer quickly is more important than getting a Getting an answer quickly is more important than getting a

correct answercorrect answer

Page 22: No SQL Database

Perbedaan Dengan Database Relasional

MySQL > 50 GB Data– Writes Average : ~300 ms– Reads Average : ~350 ms

NoSQL > 50 GB Data– Writes Average : 0.12 ms– Reads Average : 15 ms

Page 23: No SQL Database

Haruskah Menggunakan No SQL Database ?

- Untuk kita semua menggunakan database relasional seperti biasanya mungkin adalah pilihan yang paling tepat.

- Sistem penyimpanan data menggunakan No Sql database cocok untuk aplikasi yang membutuhkan data tak terstruktur yang sangat besar,seperti :

– Log Analysis– Social Networking Feeds

Page 24: No SQL Database

Introducing MongoDB

Open source, document-oriented database 10gen supports official drivers for many

platforms, but not .NET!

Page 25: No SQL Database

Introducing MongoDB

Documents in a MongoDB database are stored in schema-less collections

Documents are stored in BSON (Binary JSON) Each item in a collection has a unique (primary) key

called an ObjectId

Page 26: No SQL Database

MongoDB – Kelebihan

Memberikan primary key secara otomatis Mendukung replikasi yang berguna bagi web

yang memiliki trafik yang tinggi seperti : portal berita,forum,blog,dll.

Mendukung sharding yang digunakan pada data yang sudah mencapai juta giga.

Mendukung model pemrograman MapReduce

Page 27: No SQL Database

Instalasi mongodb di windows

Download the binaries from mongodb.org Extract to Program Files directory (or wherever) Create a directory c:\data\db Run mongod.exe from the command line with the

install switch

Page 28: No SQL Database

Mongodb shell

Connect to a server:port/database (defaults are localhost:27017/test ):

Page 29: No SQL Database

Mongodb shell cntd

Insert an item into a collection

Page 30: No SQL Database

Mongodb shell cntd

Find items in a collection:

Page 31: No SQL Database

Mongodb shell cntd

Update an item in a collection

Page 32: No SQL Database

Mongodb shell cntd

Remove an item in collection