Practical Use of a NoSQL Database

26
NoSQL use-cases you can use today Glynn Bird – Developer Advocate March 2016 Practical NoSQL

Transcript of Practical Use of a NoSQL Database

Page 1: Practical Use of a NoSQL Database

NoSQL use-cases you can use today

Glynn Bird – Developer AdvocateMarch 2016

Practical NoSQL

Page 2: Practical Use of a NoSQL Database

Introduction

@glynn_bird [email protected]

Glynn BirdDeveloper AdvocateIBM Cloud Data Serviceshttp://www.glynnbird.com

Page 3: Practical Use of a NoSQL Database

3

Agenda

NoSQL vs SQL Types of NoSQL Redis Cloudant

Page 4: Practical Use of a NoSQL Database

SQL vs NoSQL

Page 5: Practical Use of a NoSQL Database

5

RDBMs

Releational Database Management Systems SQL language developed by IBM in the 1970s RDBMs power lots of IT systems Oracle, IBM DB2, MySQL, PostgreSQL etc

Page 6: Practical Use of a NoSQL Database

6

RDBMS downsides

scalability availability price

Page 7: Practical Use of a NoSQL Database

7

NoSQL

NoSQL = "Not only SQL" Response to use-cases that a RDBMS is not a good fit Easier to scale

Page 8: Practical Use of a NoSQL Database

8

Key-Value Document

BigTable Graph

Page 9: Practical Use of a NoSQL Database

Redis

Page 10: Practical Use of a NoSQL Database

10

Redis

Key-value store In-memory storage Simple data storage structures Libraries for many programming languages Available as-a-service through Compose.io

– auto failover– free daily backups– Scalable– Enterprise Edition

Page 11: Practical Use of a NoSQL Database

11

Create a deployment

Page 12: Practical Use of a NoSQL Database

12

Demo

Page 13: Practical Use of a NoSQL Database

13

Simple Log Sharing Servicehttps://logshare.mybluemix.net/

Page 14: Practical Use of a NoSQL Database

14

Redis use-cases

Cache – time-limited data Pubsub – sharing a data stream with many clients Queues – distributing work Leaderboards – sorted sets Counting – incrementing, unique users Auto-complete – custom indexes

Page 15: Practical Use of a NoSQL Database

Cloudant

Page 16: Practical Use of a NoSQL Database

16

What is Apache CouchDB?

free, open-source, NoSQL database JSON data store built for the web - HTTP RESTful API it syncs! http://couchdb.apache.org/

Page 17: Practical Use of a NoSQL Database

Graphite & Riemann

Monitoring

ChefConfiguration Management

rsyslogFederated Logging

CollectDContinuous Integration

CouchDBJSON storage, API,

Replication

DynamoClustering, Scaling,

Fault Tolerance

LuceneText indexing &

Search

HaproxyGeo-Load Balancing

GeoJSONGeospatial indexing

& query

JenkinsContinuous Integration

Page 18: Practical Use of a NoSQL Database

18

Cloudant scales

Distributed database Add nodes to scale Fault-tolerance RESTful API

Page 19: Practical Use of a NoSQL Database

19

CRUD – Document

PrimaryIndex

Secondary Index (view)

Search Index

GeoSpatial Index

Cloudant Query

• Direct document look up by _id

• Exists “OOTB”• stored in a b-

tree• Primary key

doc._id

• Built using MapReduce

• stored in a b-tree

• Key user-defined field(s)

• Built using Lucene

• FTI: Any or all fields can be indexed

• stored in R*, TPR, KD tree

• Lat/Long coorindates in GeoJSON

• “Mongo-style” querying

• Built natively in erlang

• Use when you want a single document and can find by its _id

• Use when you can find documents based on their _id

• Pull back a range of keys

• Use when you need to analyze data or get a range of keys

• Ex: count data fields, sum/average numeric results, advanced stats, group by date, etc.

• Ad-hoc queries• Find documents

based on their contents

• Can do groups, facets, and basic geo queries (bbox & sort by distance)

• Complex geometries (polygon, circularstring, etc.)

• Advanced relations (intersect, overlaps, etc.)

• Ad-hoc queries• Lots of

operators (>, <, IN, OR, AND, etc.)

• Intuitive for people coming from Mongo or SQL backgrounds

Page 20: Practical Use of a NoSQL Database

20

Demo

Page 21: Practical Use of a NoSQL Database

21

Simple Search Service

Free, open-source Bluemix App – install with one click

Upload your .csv or .tsv– Imports data into Cloudant– Indexes everything for search– Presents HTTP Search API

Demo!

https://developer.ibm.com/clouddataservices/simple-search-service/

Page 22: Practical Use of a NoSQL Database

22

Simple Search Service Architecture

Page 23: Practical Use of a NoSQL Database

23

Simple Search Service – Production Architecture

Page 24: Practical Use of a NoSQL Database

https://developer.ibm.com/clouddataservices/simple-search-service/

https://cloudant.com/blog/turning-a-spreadsheet-into-a-faceted-search-engine-with-cloudant/

Page 25: Practical Use of a NoSQL Database

25

Cloudant use-cases

Big Data – Large data sets Scalable operational data store Search – faceted, full-text search Geo-spatial – geographic, GIS systems, GeoJSON Offline-first – replicating data to mobile devices

Page 26: Practical Use of a NoSQL Database

Glynn BirdDeveloper Advocate, Cloud Data [email protected]@glynn_birdgithub.com/glynnbirdwww.glynnbird.com