No SQL Database
description
Transcript of No SQL Database
No SQL Database
PRODI TEKNIK INFORMATIKA DAN KOMPUTERUNIVERSITAS NEGERI MAKASSAR
2012
BYNUR HIDAYA BUKHARI102904037
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.
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.
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
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.
Sejarah dan Perkembangan NoSql
Ada tiga bahasan besar yang mendorong perkembangan NoSql :– BigTable (Google)– Dynamo (Amazon)– CAP Theorem
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
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
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
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)
NoSQL ProductsNoSQL Products
Cassandra CouchDB Hadoop & Hbase MongoDB StupidDB Etc.
Perbandingan Beberapa Aplikasi NoSQL DataBase
Perbandingan Beberapa Aplikasi NoSQL DataBase
Perbandingan Beberapa Aplikasi NoSQL 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
Klasifikasi No Sql Database
XML Databases Graph Databases Codasyl Databases Object Oriented Databases Distributed Peer Stores
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)
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
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
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’})
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
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
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
Introducing MongoDB
Open source, document-oriented database 10gen supports official drivers for many
platforms, but not .NET!
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
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
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
Mongodb shell
Connect to a server:port/database (defaults are localhost:27017/test ):
Mongodb shell cntd
Insert an item into a collection
Mongodb shell cntd
Find items in a collection:
Mongodb shell cntd
Update an item in a collection
Mongodb shell cntd
Remove an item in collection