SlideShare a Scribd company logo
Introducción  a  Couchbase
Manuel  Hurtado
Solutions  Engineer
What  is  Couchbase?
©2015  Couchbase  Inc. 3
Couchbase  Server  Defined
§ Couchbase Server 4.X is the first NoSQL Database to enable
you to develop with agility and operate at any scale.
Managed Cache Key-Value Store Document Database Embedded Database Sync Management
©2015  Couchbase  Inc. 4
The Power of the Flexible JSON Schema
Ability to store data in multiple ways
• Denormalized single document, as opposed to normalizing data across multiple table
• Dynamic Schema to add new values when needed
©2015  Couchbase  Inc. 5
Document  Fundamentals  -­‐ Composition
§ Similar  to  primary  keys  in  relational  databases
§ Documents  are  partitioned  based  on  the  
document  ID
§ ID  based  document  lookup  is  extremely  fast  
§ Must  be  unique
§ JSON
§ Binary  -­‐ integers,  strings,  booleans
§ Common  binary  values  include  serialized  objects,  
compressed  XML,  compressed  text,  encrypted  
values
Document  ID  or  Key  
Value
§ CAS  Value  (unique  identifier  for  concurrency)
§ TTL
§ Flags  (optional  client  library  metadata)
§ Revision  #
Metadata
Document
Document  ID  /  
Key
MetadataValue
©2015  Couchbase  Inc. 6
Storing and Retrieving Documents
©2015  Couchbase  Inc. 7
Couchbase Data Access
• Everything is layered on top of Key Value
• A Document store is a special case of Key-
Value
• Views provide aggregation and real-time
analytics through incremental map-reduce
• Global Secondary Indexes provide low
latency/high throughput indexes
• N1QL is a language that provides a powerful
and expressive way of accessing documents
©2015  Couchbase  Inc. 8
Choose  how  to  build  your  apps,  and  where  to  run  them
Couchbase supports a wide range of frameworks, languages, platforms, and infrastructure choices
©2015  Couchbase  Inc. 9
Docker  Support
§ Deployment  Scenarios
§ Single  host,  single  container
§ Single  host  multiple  containers
§ Multiple  hosts,  single  container  on  each  host
§ Multiple  hosts,  multiple  containers  per  host
§ https://hub.docker.com/_/couchbase/
©2015  Couchbase  Inc. 10
Top  Use  Cases
Profile Management Personalization 360o Customer View Internet of Things
Content Management Catalog Real Time Big Data Digital Communication
Mobile Applications
HighAvailabilityCaching
©2015  Couchbase  Inc. 11
World  of  Operational  Databases
11
Graph  
Stores
Neo4j
RDBMS/Transactional  
Stores
Oracle,  DB2,  SQLServer,  
MySql,  Postgres
Caching  
Stores
Coherence
, Redis,  
Gemfire
Full-­‐text  
Stores
Lucene, SOLR,  
ElasticSearch
Key/Value  
Stores
Hbase,
Cassandra,  
Riak,  Dynamo
Document  Stores
Marklogic,  mongoDB,      
Cloudant,  
DocumentDB
Couchbase
Couchbase  Architecture
Single  Node
12
©2015  Couchbase  Inc. 13
Couchbase Architecture
• Data Service – builds and
maintains Distributed secondary
indexes (MapReduce Views)
• Indexing Engine – builds and
maintains Global Secondary
Indexes
• Query Engine – plans,
coordinates, and executes queries
against either Global or
Distributed indexes
• Cluster Manager – configuration,
heartbeat, statistics, RESTful
Management interface
©2015  Couchbase  Inc. 14
Couchbase  Read  Operation
APPLICATION  SERVER
MANAGED  CACHE
DISK
DISK
QUEUE
REPLICATION
QUEUE
DOC  1
GET
DOC  1
DOC  1
©2015  Couchbase  Inc. 15
APPLICATION  SERVER
MANAGED  CACHE
DISK
DISK
QUEUE
REPLICATION
QUEUE
Write  Operation
DOC  1
DOC  1DOC  1
©2015  Couchbase  Inc. 16
Auto  sharding  – Bucket  and  vBuckets  
vB
Data  buckets
vB
1                    …..                  1024
Virtual  buckets
§ A  bucket is  a  logical,  unique  key  space
§ Multiple  buckets  can  exist  within  a  single  cluster  of  nodes
§ Each  bucket  has  active  and  replica  data  sets  (1,  2  or  3  extra copies)
§ Each  data  set  has  1024  Virtual  Buckets (vBuckets)
§ Each  vBucket  contains  1/1024th  portion  of  the  data  set
§ vBuckets  do  not  have  a  fixed  physical  server  location
§ Mapping  between  the  vBuckets  and  physical  servers  is  called  the  
cluster  map
§ Document  IDs  (keys)  always  get  hashed  to  the  same  vbucket
§ Couchbase  SDK’s  lookup  the  vbucket -­‐>  server  mapping
©2015  Couchbase  Inc. 17
Cluster  Map
Couchbase Cluster
CLUSTER MAP
Hashing Algorithm
CRC32
vBucket2
vBucket3
vBucket4
vBucket5
vBucket6
vBucket7
vBucket1024
vBucket1
...
Couchbase SDK
©2015  Couchbase  Inc. 18
Cluster  Map
Couchbase Cluster
CLUSTER MAP
Hashing Algorithm
CRC32
vBucket2
vBucket3
vBucket4
vBucket5
vBucket6
vBucket7
vBucket1024
vBucket1
...
Couchbase SDK
©2015  Couchbase  Inc. 19
Cluster  Map  – 2  nodes  added
Couchbase Cluster
CLUSTER MAP
Hashing Algorithm
CRC32
vBucket2
vBucket3
vBucket4
vBucket5
vBucket6
vBucket7
vBucket1024
vBucket1
...
Couchbase SDK
©2015  Couchbase  Inc. 20
ACTIVE ACTIVE ACTIVE
REPLICA REPLICA REPLICA
Couchbase  Server  1 Couchbase  Server  2 Couchbase  Server  3
Basic  Operation
SHARD
5
SHARD
2
SHARD
9
SHARD SHARD SHARD
SHARD
4
SHARD
7
SHARD
8
SHARD SHARD SHARD
SHARD
1
SHARD
3
SHARD
6
SHARD SHARD SHARD
SHARD
4
SHARD
1
SHARD
8
SHARD SHARD SHARD
SHARD
6
SHARD
3
SHARD
2
SHARD SHARD SHARD
SHARD
7
SHARD
9
SHARD
5
SHARD SHARD SHARD
©2015  Couchbase  Inc. 21
Add  Nodes  to  Cluster
ACTIVE ACTIVE ACTIVE
REPLICA REPLICA REPLICA
Couchbase  Server  1 Couchbase  Server  2 Couchbase  Server  3
ACTIVE ACTIVE
REPLICA REPLICA
Couchbase  Server  4 Couchbase  Server  5
SHARD
5
SHARD
2
SHARD SHARD
SHARD
4
SHARD SHARD
SHARD
1
SHARD
3
SHARD SHARD
SHARD
4
SHARD
1
SHARD
8
SHARD SHARD SHARD
SHARD
6
SHARD
3
SHARD
2
SHARD SHARD SHARD
SHARD
7
SHARD
9
SHARD
5
SHARD SHARD SHARD
SHARD
7
SHARD
SHARD
6
SHARD
SHARD
8
SHARD
9
SHARD
READ/WRITE/UPDATE
©2015  Couchbase  Inc. 22
Fail  Over  Node
ACTIVE ACTIVE ACTIVE
REPLICA REPLICA REPLICA
Couchbase  Server  1 Couchbase  Server  2 Couchbase  Server  3
ACTIVE ACTIVE
REPLICA REPLICA
Couchbase  Server  4 Couchbase  Server  5
SHARD
5
SHARD
2
SHARD SHARD
SHARD
4
SHARD SHARD
SHARD
1
SHARD
3
SHARD SHARD
SHARD
4
SHARD
1
SHARD
8
SHARD SHARD
SHARDSHARD
6
SHARD
2
SHARD SHARD SHARD
SHARD
7
SHARD
9
SHARD
5
SHARD SHARD
SHARD
SHARD
7
SHARD
SHARD
6
SHARDSHARD
8
SHARD
9
SHARD
SHARD
3
SHARD
1
SHARD
3
SHARD
©2015  Couchbase  Inc. 23
Modern Architecture – Multi-Dimensional Scaling
MDS is the architecture that enables independent scaling of
data, query, and indexing workloads while being managed as
one cluster.
©2015  Couchbase  Inc. 24
Modern Architecture – Multi-Dimensional Scaling
©2015  Couchbase  Inc. 25
Modern Architecture – Multi-Dimensional Scaling
©2015  Couchbase  Inc. 26
Demo: Install Couchbase
§ Install  node  1
§ Add  node  2
§ Rebalance
§ Admin  UI
beer-­‐sample travel-­‐sample
node  1
192.168.56.101
node  2
192.168.56.102
Cluster  Madrid  prod
Cross  Datacenter  Replication  
(XDCR)
27
©2015  Couchbase  Inc. 28
XDCR:  Cross  Data  Center  Replication
§ Application  can  access  both  clusters  (master  – master)
§ Scales  out  linearly
§ Within  a  cluster  operations  are  strongly  consistent  and  you  can  read-­‐
your-­‐own-­‐write.  Between  clusters  mutations  are  eventually  consistent.
©2015  Couchbase  Inc. 29
Memory-­‐to-­‐memory,  topology  aware  replication
New  York
San  Francisco
SF Server Cluster
Couchbase Server 1
MEMORY DISK
Couchbase Server 2
MEMORY DISK
Couchbase Server 3
MEMORY DISK
NYC Server Cluster
Couchbase Server 1
MEMORY DISK
Couchbase Server 2
MEMORY DISK
Couchbase Server 3
MEMORY DISK
Couchbase Server 4
MEMORY DISK
USE  CASES
§ Access  by  Localization
§ Active-­‐Active
§ Active-­‐Passive
§ Disaster  Recovery
§ BI  environment
§ Test  environment
©2015  Couchbase  Inc. 30
Demo: XDCR: Replicate data between clusters
§ Install  node  3  /  Cluster  backup
§ Enable  XDCR  between  clusters
§ Replicate  airlines
Developing  an  Application
31
©2015  Couchbase  Inc. 32
Languages  and  Interfaces  for  Couchbase
§ Official  SDKs
– Java
– .NET
– Node.js
– Python
§ For  each  of  these  we  have
– Full  Document  support
– Interoperability
– Common  Programming  Model
Others:  Erlang,  Perl,  TCL,  Clojure,  Scala
– PHP
– C
– Go
– Ruby
JDBC  and  ODBC
©2015  Couchbase  Inc. 33
Interacting  with  Data
Views
N1QL
Query
Key  Value  Store
JSON  Documents
Document  Modeling
©2015  Couchbase  Inc. 35
Data  Modeling
§ An  ecommerce  order  in  relational  world
©2015  Couchbase  Inc. 36
Data  Modeling
§ Embed vs  Refer
©2015  Couchbase  Inc. 37
Data  Modeling
§ Embed  vs  Refer
©2015  Couchbase  Inc. 38
Reference  Documents  for  Lookups
38
§ Lookup  documents  which  reference  the  
primary  one
§ PROS
§ High  Performance
§ Extremely  scalable
§ Immediately  consistent
§ CONS
§ Needs  to  be  maintained  by  the  application
§ GSI  is  a  viable  alternative
§ PROS
§ No  need  for  Referential  integrity
§ Good  performance
§ CONS
§ Not  immediately  consistent  -­‐ but  can  optional  wait  
for  index  updates  (READ  YOUR  OWN  WRITES)
©2015  Couchbase  Inc. 39
Compound  keys:  example
u::1001
{
"name": "Matthew Revell",
"email": "matthew@couchbase.com",
"address": "11-21 Paul Street",
"city": "London",
"postCode": "EC2A 4JU",
"telephone": "44-20-3837-9130",
"orders": [ 1, 9, 698, 32 ],
“productsViewed”: [8, 33, 99, 100]
}
©2015  Couchbase  Inc. 40
Compound  keys:  example
u::1001
{
"name": "Matthew Revell",
"email": "matthew@couchbase.com",
"address": "11-21 Paul Street",
"city": "London",
"postCode": "EC2A 4JU",
"telephone": "44-20-3837-9130",
"orders": [ 1, 9, 698, 32 ]
}
u::1001::productsviewed
{
"productsList": [
8, 33, 99, 100
]
}
©2015  Couchbase  Inc. 41
Compound  keys:  example
u::1001
{
"name": "Matthew Revell",
"email": "matthew@couchbase.com",
"address": "11-21 Paul Street",
"city": "London",
"postCode": "EC2A 4JU",
"telephone": "44-20-3837-9130",
"orders": [ 1, 9, 698, 32 ]
}
u::1001::productsviewed
{
"productsList": [
8, 33, 99, 100
]
}
p::8
{
id": 1,
"name": "T-shirt",
"description": "Red Couchbase shirt",
"quantityInStock": 99,
"image": "tshirt.jpg”
}
©2015  Couchbase  Inc. 42
Compound  keys:  example
u::1001
{
"name": "Matthew Revell",
"email": "matthew@couchbase.com",
"address": "11-21 Paul Street",
"city": "London",
"postCode": "EC2A 4JU",
"telephone": "44-20-3837-9130",
"orders": [ 1, 9, 698, 32 ]
}
u::1001::productsviewed
{
"productsList": [
8, 33, 99, 100
]
}
p::8
{
id": 1,
"name": "T-shirt",
"description": "Red Couchbase shirt",
"quantityInStock": 99
}
p::8::img
“http://someurl.com/tshirt.jpg”
©2015  Couchbase  Inc. 43
Demo: Code examples: CRUD
Sample  code  for:
§ Create  
§ Read
§ Update
§ Delete
Couchbase  Query  (N1QL)
N1QL  Introduction
©2015  Couchbase  Inc. 45
Why  SQL  for  JSON?
JSON Documents Provide
RichStructure
(Noassembly)
StructureEvolution
(Flexibleschema,easytochange)
SQL Provides
Generalqueryfunctionality
Queryacrossrelationships
Why N1QL?
Mostdevelopersalreadyknow
SQL
Noneedforcomplexquery
frameworks
©2015  Couchbase  Inc. 46
SELECT
§ Standard  SELECT  pipeline
– SELECT,  FROM,  WHERE,  GROUP  BY,  ORDER  BY,  LIMIT,  OFFSET
§ Queries  across  relationships
– JOINs
– Subqueries
– NEST  — a  JOIN  that  embeds  child  objects  within  their  parent
– UNNEST  — a  JOIN  that  surfaces  nested  objects  as  top-­‐level  data
§ Aggregation
§ Set  operators
– UNION,  INTERSECT,  EXCEPT
©2015  Couchbase  Inc. 47
Indexing
§ CREATE  /  DROP  INDEX
§ Two  types  of  indexes
– View  indexes
– GSI  indexes  (global  secondary  indexes)
§ Can  index  any  data  expression
– Nested  /  complex  expressions
– Computed  expressions
§ EXPLAIN
©2015  Couchbase  Inc. 48
Data  writes
§ UPDATE  …  WHERE  …
– Partial  updates;  deep  updates
§ DELETE  …  WHERE  …
– Deeply  nested  conditions
§ INSERT  …  VALUES  …;  INSERT  …  SELECT  …
– Bulk  insert;  transfer  and  transformation
§ MERGE
– INSERT  or  UPDATE;  ETL  support
©2015  Couchbase  Inc. 49
Document-­‐oriented  Extensions
§ Nested
– Paths—user.profile.email,  children[0],  children[0:2]
– NEST,  UNNEST
– Ranging—EVERY  child.age  >  5  FOR child  IN children  END
– Transformations—SELECT  {“name”:  first_name  ||  last_name}
§ Non-­‐uniform
– IS  MISSING
– Type  checking  and  conversion
§ Distributed
– Direct  lookup—USE  KEYS
– Efficient  joins—ON  KEYS
©2015  Couchbase  Inc. 50
Expressions
©2014  Couchbase,  Inc.  
50
Expressions
Literals
q Primitives  [  0,  ‘hello’,  TRUE  ]
q NULL
Operators
q Arithmetic  [ +,  -­‐,  *,  /, %  ]
q Logical  [  AND,  OR, NOT  ]
q Comparison  [  <,  <=,  =,  !=,  >=,  >,  BETWEEN,  IS  NULL  ]
q Pattern  matching  [  LIKE  ]
q Conditional  [  CASE  ]
Scalar  functions
q Numeric  [  trigonometric, ROUND,  TRUNC,  …  ]
q String  [  UPPER,  LOWER, TRIM,  SUBSTR,  …  ]
q Date  [ string  and  numeric  dates,  NOW,  date  arithmetic,  … ]
Aggregate functions q MIN,  MAX,  SUM,  AVG, COUNT  [  DISTINCT  ]
Subqueries q Subqueries are  full  expressions
©2015  Couchbase  Inc. 51
Document-­‐Oriented  Expression  Features
©2014  Couchbase,  Inc.  
51
Features
Ranging  over  collections
WHERE  ANY c  IN  children  SATISFIES  c.age  >  10  END
WHERE EVERY r  IN  ratings  SATISFIES  r  >  3  END
Mapping  with  filtering ARRAY c.name  FOR  c  IN  children  WHEN c.age  > 10  END
Deep  traversal and  update
WHERE ANY  node  WITHIN request  SATISFIES  node.type  =  “xyz”  END
UPDATE  doc  SET c.name  =  Title(c.name)  FOR  c  WITHIN doc  END
Dynamic Construction
SELECT  { “a”:  expr1,  “b”:  expr2  }  AS  obj1,  name  FROM  …  //  Dynamic  object
SELECT  [  a,  b  ]  FROM  …  //  Dynamic array
Nested  sourcing SELECT *  FROM  a.b.c  …  //  Select  from  nested  objects
©2015  Couchbase  Inc. 52
Demo: N1QL samples
N1QL  Queries  from
§ Web  UI
§ Command  line  cbq
§ REST
Summary
53
©2015  Couchbase  Inc. 54
Develop  with  Agility
With  Couchbase  Server,  you  can  Develop  Applications  with  Agility.  Here’s  why:
Easier,  Faster  Development Flexible  Data  Modeling Powerful  Querying
SQL  Integration  &  Migration Big  Data  Integration Mobile  /  IoT
©2015  Couchbase  Inc. 55
Operate  at  Any  Scale
With  Couchbase  Server,  you  can  deploy,  manage,  and  scale  apps  without  limits.  Here’s  why:
Elastic Scalability Consistent High
Performance
Always-on Availability
Multi-Data Center Deployment Simple, Powerful
Administration
Enterprise Grade Security
Q&A
56
©2015  Couchbase  Inc. 57
Additional  Resources
57
§ Couchbase  Labs:  https://github.com/couchbaselabs
§ Sample  Applications:
§ https://github.com/couchbaselabs?utf8=%E2%9C%93&query=try
§ https://github.com/couchbaselabs?utf8=%E2%9C%93&query=beer
§ General  Docs:  http://docs.couchbase.com
§ Query  Portal:  http://query.couchbase.com
§ Blog:  http://blog.couchbase.com
§ Forum:  http://forums.couchbase.com
©2015  Couchbase  Inc. 58
beer-­‐sample travel-­‐sample
node  1
192.168.56.101
node  2
192.168.56.102
Cluster  Madrid  prod
airlines
node  3
192.168.56.1013
Cluster  Backup
XDCR
airlines
©2015  Couchbase  Inc. 59
airlines
node  3
192.168.56.1013
Cluster  Backup

More Related Content

What's hot

Kafka on Kubernetes—From Evaluation to Production at Intuit
Kafka on Kubernetes—From Evaluation to Production at Intuit Kafka on Kubernetes—From Evaluation to Production at Intuit
Kafka on Kubernetes—From Evaluation to Production at Intuit
confluent
 

What's hot (18)

Docker+java
Docker+javaDocker+java
Docker+java
 
Distributed Locking in Kubernetes
Distributed Locking in KubernetesDistributed Locking in Kubernetes
Distributed Locking in Kubernetes
 
Where is my cache architectural patterns for caching microservices by example
Where is my cache  architectural patterns for caching microservices by exampleWhere is my cache  architectural patterns for caching microservices by example
Where is my cache architectural patterns for caching microservices by example
 
Build Your Kubernetes Operator with the Right Tool!
Build Your Kubernetes Operator with the Right Tool!Build Your Kubernetes Operator with the Right Tool!
Build Your Kubernetes Operator with the Right Tool!
 
How Scylla Manager Handles Backups
How Scylla Manager Handles BackupsHow Scylla Manager Handles Backups
How Scylla Manager Handles Backups
 
Kubernetes #2 monitoring
Kubernetes #2   monitoring Kubernetes #2   monitoring
Kubernetes #2 monitoring
 
Kubecon 2019_eu-k8s-secrets-csi
Kubecon 2019_eu-k8s-secrets-csiKubecon 2019_eu-k8s-secrets-csi
Kubecon 2019_eu-k8s-secrets-csi
 
Introduction to Kubernetes Workshop
Introduction to Kubernetes WorkshopIntroduction to Kubernetes Workshop
Introduction to Kubernetes Workshop
 
Leonid Vasilyev "Building, deploying and running production code at Dropbox"
Leonid Vasilyev  "Building, deploying and running production code at Dropbox"Leonid Vasilyev  "Building, deploying and running production code at Dropbox"
Leonid Vasilyev "Building, deploying and running production code at Dropbox"
 
Architectural patterns for high performance microservices in kubernetes
Architectural patterns for high performance microservices in kubernetesArchitectural patterns for high performance microservices in kubernetes
Architectural patterns for high performance microservices in kubernetes
 
Cloud Native Applications on Kubernetes: a DevOps Approach
Cloud Native Applications on Kubernetes: a DevOps ApproachCloud Native Applications on Kubernetes: a DevOps Approach
Cloud Native Applications on Kubernetes: a DevOps Approach
 
OSDC 2018 | Monitoring Kubernetes at Scale by Monica Sarbu
OSDC 2018 | Monitoring Kubernetes at Scale by Monica SarbuOSDC 2018 | Monitoring Kubernetes at Scale by Monica Sarbu
OSDC 2018 | Monitoring Kubernetes at Scale by Monica Sarbu
 
DevOps Fest 2020. Сергій Калінець. Building Data Streaming Platform with Apac...
DevOps Fest 2020. Сергій Калінець. Building Data Streaming Platform with Apac...DevOps Fest 2020. Сергій Калінець. Building Data Streaming Platform with Apac...
DevOps Fest 2020. Сергій Калінець. Building Data Streaming Platform with Apac...
 
Service Discovery In Kubernetes
Service Discovery In KubernetesService Discovery In Kubernetes
Service Discovery In Kubernetes
 
5 Levels of High Availability: From Multi-instance to Hybrid Cloud
5 Levels of High Availability: From Multi-instance to Hybrid Cloud5 Levels of High Availability: From Multi-instance to Hybrid Cloud
5 Levels of High Availability: From Multi-instance to Hybrid Cloud
 
Intro to creating kubernetes operators
Intro to creating kubernetes operators Intro to creating kubernetes operators
Intro to creating kubernetes operators
 
Kafka on Kubernetes—From Evaluation to Production at Intuit
Kafka on Kubernetes—From Evaluation to Production at Intuit Kafka on Kubernetes—From Evaluation to Production at Intuit
Kafka on Kubernetes—From Evaluation to Production at Intuit
 
Getting started with kubernetes
Getting started with kubernetesGetting started with kubernetes
Getting started with kubernetes
 

Viewers also liked

Viewers also liked (18)

ECMAScript 6
ECMAScript 6ECMAScript 6
ECMAScript 6
 
Analysis of Websites as Graphs for SEO
Analysis of Websites as Graphs for SEOAnalysis of Websites as Graphs for SEO
Analysis of Websites as Graphs for SEO
 
Use Groovy&Grails in your spring boot projects
Use Groovy&Grails in your spring boot projectsUse Groovy&Grails in your spring boot projects
Use Groovy&Grails in your spring boot projects
 
Cómo usar google analytics
Cómo usar google analyticsCómo usar google analytics
Cómo usar google analytics
 
Kafka y python
Kafka y pythonKafka y python
Kafka y python
 
Google Analytics for Developers
Google Analytics for DevelopersGoogle Analytics for Developers
Google Analytics for Developers
 
Programación Reactiva con RxJava
Programación Reactiva con RxJavaProgramación Reactiva con RxJava
Programación Reactiva con RxJava
 
Overview atlas (1)
Overview atlas (1)Overview atlas (1)
Overview atlas (1)
 
Transformación Digital
Transformación DigitalTransformación Digital
Transformación Digital
 
¿Cómo vencer a los dragones digitales?
¿Cómo vencer a los dragones digitales?¿Cómo vencer a los dragones digitales?
¿Cómo vencer a los dragones digitales?
 
Python y Flink
Python y FlinkPython y Flink
Python y Flink
 
Introducción a Kubernetes
Introducción a KubernetesIntroducción a Kubernetes
Introducción a Kubernetes
 
HTML5 Web Components
HTML5 Web ComponentsHTML5 Web Components
HTML5 Web Components
 
Introducción a Django
Introducción a DjangoIntroducción a Django
Introducción a Django
 
Couchbase Day
Couchbase DayCouchbase Day
Couchbase Day
 
¿Cómo se despliega y autoescala Couchbase en Cloud? ¡Aprende de manera práctica!
¿Cómo se despliega y autoescala Couchbase en Cloud? ¡Aprende de manera práctica!¿Cómo se despliega y autoescala Couchbase en Cloud? ¡Aprende de manera práctica!
¿Cómo se despliega y autoescala Couchbase en Cloud? ¡Aprende de manera práctica!
 
Cultura Digital Paradigma
Cultura Digital ParadigmaCultura Digital Paradigma
Cultura Digital Paradigma
 
PostgreSQL vs MySQL: PostgreSQL como alternativa.
PostgreSQL vs MySQL: PostgreSQL como alternativa.PostgreSQL vs MySQL: PostgreSQL como alternativa.
PostgreSQL vs MySQL: PostgreSQL como alternativa.
 

Similar to Manuel Hurtado. Couchbase paradigma4oct

001 hbase introduction
001 hbase introduction001 hbase introduction
001 hbase introduction
Scott Miao
 

Similar to Manuel Hurtado. Couchbase paradigma4oct (20)

BI, Reporting and Analytics on Apache Cassandra
BI, Reporting and Analytics on Apache CassandraBI, Reporting and Analytics on Apache Cassandra
BI, Reporting and Analytics on Apache Cassandra
 
5 Factors When Selecting a High Performance, Low Latency Database
5 Factors When Selecting a High Performance, Low Latency Database5 Factors When Selecting a High Performance, Low Latency Database
5 Factors When Selecting a High Performance, Low Latency Database
 
IBM - Introduction to Cloudant
IBM - Introduction to CloudantIBM - Introduction to Cloudant
IBM - Introduction to Cloudant
 
0812 2014 01_toronto-smac meetup_i_os_cloudant_worklight_part2
0812 2014 01_toronto-smac meetup_i_os_cloudant_worklight_part20812 2014 01_toronto-smac meetup_i_os_cloudant_worklight_part2
0812 2014 01_toronto-smac meetup_i_os_cloudant_worklight_part2
 
Real Time Streaming with Flink & Couchbase
Real Time Streaming with Flink & CouchbaseReal Time Streaming with Flink & Couchbase
Real Time Streaming with Flink & Couchbase
 
SQL Engines for Hadoop - The case for Impala
SQL Engines for Hadoop - The case for ImpalaSQL Engines for Hadoop - The case for Impala
SQL Engines for Hadoop - The case for Impala
 
Migration and Coexistence between Relational and NoSQL Databases by Manuel H...
 Migration and Coexistence between Relational and NoSQL Databases by Manuel H... Migration and Coexistence between Relational and NoSQL Databases by Manuel H...
Migration and Coexistence between Relational and NoSQL Databases by Manuel H...
 
001 hbase introduction
001 hbase introduction001 hbase introduction
001 hbase introduction
 
Big Data and NoSQL for Database and BI Pros
Big Data and NoSQL for Database and BI ProsBig Data and NoSQL for Database and BI Pros
Big Data and NoSQL for Database and BI Pros
 
Couchbase Singapore Meetup #2: Why Developing with Couchbase is easy !!
Couchbase Singapore Meetup #2:  Why Developing with Couchbase is easy !! Couchbase Singapore Meetup #2:  Why Developing with Couchbase is easy !!
Couchbase Singapore Meetup #2: Why Developing with Couchbase is easy !!
 
NoSQL_Night
NoSQL_NightNoSQL_Night
NoSQL_Night
 
Couchbase Chennai Meetup: Developing with Couchbase- made easy
Couchbase Chennai Meetup:  Developing with Couchbase- made easyCouchbase Chennai Meetup:  Developing with Couchbase- made easy
Couchbase Chennai Meetup: Developing with Couchbase- made easy
 
Couchbase Data Pipeline
Couchbase Data PipelineCouchbase Data Pipeline
Couchbase Data Pipeline
 
Couchbase 101
Couchbase 101 Couchbase 101
Couchbase 101
 
Billions of Messages in Real Time: Why Paypal & LinkedIn Trust an Engagement ...
Billions of Messages in Real Time: Why Paypal & LinkedIn Trust an Engagement ...Billions of Messages in Real Time: Why Paypal & LinkedIn Trust an Engagement ...
Billions of Messages in Real Time: Why Paypal & LinkedIn Trust an Engagement ...
 
Scylla Summit 2019 Keynote - Avi Kivity
Scylla Summit 2019 Keynote - Avi KivityScylla Summit 2019 Keynote - Avi Kivity
Scylla Summit 2019 Keynote - Avi Kivity
 
NoSQL on the move
NoSQL on the moveNoSQL on the move
NoSQL on the move
 
Couchbase - Yet Another Introduction
Couchbase - Yet Another IntroductionCouchbase - Yet Another Introduction
Couchbase - Yet Another Introduction
 
Building Fast Applications for Streaming Data
Building Fast Applications for Streaming DataBuilding Fast Applications for Streaming Data
Building Fast Applications for Streaming Data
 
Lightning Talk: Why and How to Integrate MongoDB and NoSQL into Hadoop Big Da...
Lightning Talk: Why and How to Integrate MongoDB and NoSQL into Hadoop Big Da...Lightning Talk: Why and How to Integrate MongoDB and NoSQL into Hadoop Big Da...
Lightning Talk: Why and How to Integrate MongoDB and NoSQL into Hadoop Big Da...
 

More from Paradigma Digital

More from Paradigma Digital (14)

Ddd + ah + microservicios
Ddd + ah + microserviciosDdd + ah + microservicios
Ddd + ah + microservicios
 
Bots 3.0: Dejando atrás los bots conversacionales con Dialogflow.
Bots 3.0: Dejando atrás los bots conversacionales con Dialogflow.Bots 3.0: Dejando atrás los bots conversacionales con Dialogflow.
Bots 3.0: Dejando atrás los bots conversacionales con Dialogflow.
 
Have you met Istio?
Have you met Istio?Have you met Istio?
Have you met Istio?
 
Linkerd a fondo
Linkerd a fondoLinkerd a fondo
Linkerd a fondo
 
Horneando apis
Horneando apisHorneando apis
Horneando apis
 
Java 8 time to join the future
Java 8  time to join the futureJava 8  time to join the future
Java 8 time to join the future
 
Programación Reactiva con Spring WebFlux
Programación Reactiva con Spring WebFluxProgramación Reactiva con Spring WebFlux
Programación Reactiva con Spring WebFlux
 
Orquestando microservicios como lo hace Netflix
Orquestando microservicios como lo hace NetflixOrquestando microservicios como lo hace Netflix
Orquestando microservicios como lo hace Netflix
 
Meetup microservicios: API Management
Meetup microservicios: API ManagementMeetup microservicios: API Management
Meetup microservicios: API Management
 
Meetup de kubernetes, conceptos básicos.
Meetup  de kubernetes, conceptos básicos.Meetup  de kubernetes, conceptos básicos.
Meetup de kubernetes, conceptos básicos.
 
Docker, kubernetes, openshift y openstack, para mi abuela. techfest 2017.pptx
Docker, kubernetes, openshift y openstack, para mi abuela. techfest 2017.pptxDocker, kubernetes, openshift y openstack, para mi abuela. techfest 2017.pptx
Docker, kubernetes, openshift y openstack, para mi abuela. techfest 2017.pptx
 
Implementando microservicios
Implementando microserviciosImplementando microservicios
Implementando microservicios
 
Equipo de Marketing de Paradigma Digital
Equipo de Marketing de Paradigma DigitalEquipo de Marketing de Paradigma Digital
Equipo de Marketing de Paradigma Digital
 
Seminario Apache Solr
Seminario Apache SolrSeminario Apache Solr
Seminario Apache Solr
 

Recently uploaded

Recently uploaded (20)

Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 

Manuel Hurtado. Couchbase paradigma4oct

  • 1. Introducción  a  Couchbase Manuel  Hurtado Solutions  Engineer
  • 3. ©2015  Couchbase  Inc. 3 Couchbase  Server  Defined § Couchbase Server 4.X is the first NoSQL Database to enable you to develop with agility and operate at any scale. Managed Cache Key-Value Store Document Database Embedded Database Sync Management
  • 4. ©2015  Couchbase  Inc. 4 The Power of the Flexible JSON Schema Ability to store data in multiple ways • Denormalized single document, as opposed to normalizing data across multiple table • Dynamic Schema to add new values when needed
  • 5. ©2015  Couchbase  Inc. 5 Document  Fundamentals  -­‐ Composition § Similar  to  primary  keys  in  relational  databases § Documents  are  partitioned  based  on  the   document  ID § ID  based  document  lookup  is  extremely  fast   § Must  be  unique § JSON § Binary  -­‐ integers,  strings,  booleans § Common  binary  values  include  serialized  objects,   compressed  XML,  compressed  text,  encrypted   values Document  ID  or  Key   Value § CAS  Value  (unique  identifier  for  concurrency) § TTL § Flags  (optional  client  library  metadata) § Revision  # Metadata Document Document  ID  /   Key MetadataValue
  • 6. ©2015  Couchbase  Inc. 6 Storing and Retrieving Documents
  • 7. ©2015  Couchbase  Inc. 7 Couchbase Data Access • Everything is layered on top of Key Value • A Document store is a special case of Key- Value • Views provide aggregation and real-time analytics through incremental map-reduce • Global Secondary Indexes provide low latency/high throughput indexes • N1QL is a language that provides a powerful and expressive way of accessing documents
  • 8. ©2015  Couchbase  Inc. 8 Choose  how  to  build  your  apps,  and  where  to  run  them Couchbase supports a wide range of frameworks, languages, platforms, and infrastructure choices
  • 9. ©2015  Couchbase  Inc. 9 Docker  Support § Deployment  Scenarios § Single  host,  single  container § Single  host  multiple  containers § Multiple  hosts,  single  container  on  each  host § Multiple  hosts,  multiple  containers  per  host § https://hub.docker.com/_/couchbase/
  • 10. ©2015  Couchbase  Inc. 10 Top  Use  Cases Profile Management Personalization 360o Customer View Internet of Things Content Management Catalog Real Time Big Data Digital Communication Mobile Applications HighAvailabilityCaching
  • 11. ©2015  Couchbase  Inc. 11 World  of  Operational  Databases 11 Graph   Stores Neo4j RDBMS/Transactional   Stores Oracle,  DB2,  SQLServer,   MySql,  Postgres Caching   Stores Coherence , Redis,   Gemfire Full-­‐text   Stores Lucene, SOLR,   ElasticSearch Key/Value   Stores Hbase, Cassandra,   Riak,  Dynamo Document  Stores Marklogic,  mongoDB,       Cloudant,   DocumentDB Couchbase
  • 13. ©2015  Couchbase  Inc. 13 Couchbase Architecture • Data Service – builds and maintains Distributed secondary indexes (MapReduce Views) • Indexing Engine – builds and maintains Global Secondary Indexes • Query Engine – plans, coordinates, and executes queries against either Global or Distributed indexes • Cluster Manager – configuration, heartbeat, statistics, RESTful Management interface
  • 14. ©2015  Couchbase  Inc. 14 Couchbase  Read  Operation APPLICATION  SERVER MANAGED  CACHE DISK DISK QUEUE REPLICATION QUEUE DOC  1 GET DOC  1 DOC  1
  • 15. ©2015  Couchbase  Inc. 15 APPLICATION  SERVER MANAGED  CACHE DISK DISK QUEUE REPLICATION QUEUE Write  Operation DOC  1 DOC  1DOC  1
  • 16. ©2015  Couchbase  Inc. 16 Auto  sharding  – Bucket  and  vBuckets   vB Data  buckets vB 1                    …..                  1024 Virtual  buckets § A  bucket is  a  logical,  unique  key  space § Multiple  buckets  can  exist  within  a  single  cluster  of  nodes § Each  bucket  has  active  and  replica  data  sets  (1,  2  or  3  extra copies) § Each  data  set  has  1024  Virtual  Buckets (vBuckets) § Each  vBucket  contains  1/1024th  portion  of  the  data  set § vBuckets  do  not  have  a  fixed  physical  server  location § Mapping  between  the  vBuckets  and  physical  servers  is  called  the   cluster  map § Document  IDs  (keys)  always  get  hashed  to  the  same  vbucket § Couchbase  SDK’s  lookup  the  vbucket -­‐>  server  mapping
  • 17. ©2015  Couchbase  Inc. 17 Cluster  Map Couchbase Cluster CLUSTER MAP Hashing Algorithm CRC32 vBucket2 vBucket3 vBucket4 vBucket5 vBucket6 vBucket7 vBucket1024 vBucket1 ... Couchbase SDK
  • 18. ©2015  Couchbase  Inc. 18 Cluster  Map Couchbase Cluster CLUSTER MAP Hashing Algorithm CRC32 vBucket2 vBucket3 vBucket4 vBucket5 vBucket6 vBucket7 vBucket1024 vBucket1 ... Couchbase SDK
  • 19. ©2015  Couchbase  Inc. 19 Cluster  Map  – 2  nodes  added Couchbase Cluster CLUSTER MAP Hashing Algorithm CRC32 vBucket2 vBucket3 vBucket4 vBucket5 vBucket6 vBucket7 vBucket1024 vBucket1 ... Couchbase SDK
  • 20. ©2015  Couchbase  Inc. 20 ACTIVE ACTIVE ACTIVE REPLICA REPLICA REPLICA Couchbase  Server  1 Couchbase  Server  2 Couchbase  Server  3 Basic  Operation SHARD 5 SHARD 2 SHARD 9 SHARD SHARD SHARD SHARD 4 SHARD 7 SHARD 8 SHARD SHARD SHARD SHARD 1 SHARD 3 SHARD 6 SHARD SHARD SHARD SHARD 4 SHARD 1 SHARD 8 SHARD SHARD SHARD SHARD 6 SHARD 3 SHARD 2 SHARD SHARD SHARD SHARD 7 SHARD 9 SHARD 5 SHARD SHARD SHARD
  • 21. ©2015  Couchbase  Inc. 21 Add  Nodes  to  Cluster ACTIVE ACTIVE ACTIVE REPLICA REPLICA REPLICA Couchbase  Server  1 Couchbase  Server  2 Couchbase  Server  3 ACTIVE ACTIVE REPLICA REPLICA Couchbase  Server  4 Couchbase  Server  5 SHARD 5 SHARD 2 SHARD SHARD SHARD 4 SHARD SHARD SHARD 1 SHARD 3 SHARD SHARD SHARD 4 SHARD 1 SHARD 8 SHARD SHARD SHARD SHARD 6 SHARD 3 SHARD 2 SHARD SHARD SHARD SHARD 7 SHARD 9 SHARD 5 SHARD SHARD SHARD SHARD 7 SHARD SHARD 6 SHARD SHARD 8 SHARD 9 SHARD READ/WRITE/UPDATE
  • 22. ©2015  Couchbase  Inc. 22 Fail  Over  Node ACTIVE ACTIVE ACTIVE REPLICA REPLICA REPLICA Couchbase  Server  1 Couchbase  Server  2 Couchbase  Server  3 ACTIVE ACTIVE REPLICA REPLICA Couchbase  Server  4 Couchbase  Server  5 SHARD 5 SHARD 2 SHARD SHARD SHARD 4 SHARD SHARD SHARD 1 SHARD 3 SHARD SHARD SHARD 4 SHARD 1 SHARD 8 SHARD SHARD SHARDSHARD 6 SHARD 2 SHARD SHARD SHARD SHARD 7 SHARD 9 SHARD 5 SHARD SHARD SHARD SHARD 7 SHARD SHARD 6 SHARDSHARD 8 SHARD 9 SHARD SHARD 3 SHARD 1 SHARD 3 SHARD
  • 23. ©2015  Couchbase  Inc. 23 Modern Architecture – Multi-Dimensional Scaling MDS is the architecture that enables independent scaling of data, query, and indexing workloads while being managed as one cluster.
  • 24. ©2015  Couchbase  Inc. 24 Modern Architecture – Multi-Dimensional Scaling
  • 25. ©2015  Couchbase  Inc. 25 Modern Architecture – Multi-Dimensional Scaling
  • 26. ©2015  Couchbase  Inc. 26 Demo: Install Couchbase § Install  node  1 § Add  node  2 § Rebalance § Admin  UI beer-­‐sample travel-­‐sample node  1 192.168.56.101 node  2 192.168.56.102 Cluster  Madrid  prod
  • 28. ©2015  Couchbase  Inc. 28 XDCR:  Cross  Data  Center  Replication § Application  can  access  both  clusters  (master  – master) § Scales  out  linearly § Within  a  cluster  operations  are  strongly  consistent  and  you  can  read-­‐ your-­‐own-­‐write.  Between  clusters  mutations  are  eventually  consistent.
  • 29. ©2015  Couchbase  Inc. 29 Memory-­‐to-­‐memory,  topology  aware  replication New  York San  Francisco SF Server Cluster Couchbase Server 1 MEMORY DISK Couchbase Server 2 MEMORY DISK Couchbase Server 3 MEMORY DISK NYC Server Cluster Couchbase Server 1 MEMORY DISK Couchbase Server 2 MEMORY DISK Couchbase Server 3 MEMORY DISK Couchbase Server 4 MEMORY DISK USE  CASES § Access  by  Localization § Active-­‐Active § Active-­‐Passive § Disaster  Recovery § BI  environment § Test  environment
  • 30. ©2015  Couchbase  Inc. 30 Demo: XDCR: Replicate data between clusters § Install  node  3  /  Cluster  backup § Enable  XDCR  between  clusters § Replicate  airlines
  • 32. ©2015  Couchbase  Inc. 32 Languages  and  Interfaces  for  Couchbase § Official  SDKs – Java – .NET – Node.js – Python § For  each  of  these  we  have – Full  Document  support – Interoperability – Common  Programming  Model Others:  Erlang,  Perl,  TCL,  Clojure,  Scala – PHP – C – Go – Ruby JDBC  and  ODBC
  • 33. ©2015  Couchbase  Inc. 33 Interacting  with  Data Views N1QL Query Key  Value  Store JSON  Documents
  • 35. ©2015  Couchbase  Inc. 35 Data  Modeling § An  ecommerce  order  in  relational  world
  • 36. ©2015  Couchbase  Inc. 36 Data  Modeling § Embed vs  Refer
  • 37. ©2015  Couchbase  Inc. 37 Data  Modeling § Embed  vs  Refer
  • 38. ©2015  Couchbase  Inc. 38 Reference  Documents  for  Lookups 38 § Lookup  documents  which  reference  the   primary  one § PROS § High  Performance § Extremely  scalable § Immediately  consistent § CONS § Needs  to  be  maintained  by  the  application § GSI  is  a  viable  alternative § PROS § No  need  for  Referential  integrity § Good  performance § CONS § Not  immediately  consistent  -­‐ but  can  optional  wait   for  index  updates  (READ  YOUR  OWN  WRITES)
  • 39. ©2015  Couchbase  Inc. 39 Compound  keys:  example u::1001 { "name": "Matthew Revell", "email": "matthew@couchbase.com", "address": "11-21 Paul Street", "city": "London", "postCode": "EC2A 4JU", "telephone": "44-20-3837-9130", "orders": [ 1, 9, 698, 32 ], “productsViewed”: [8, 33, 99, 100] }
  • 40. ©2015  Couchbase  Inc. 40 Compound  keys:  example u::1001 { "name": "Matthew Revell", "email": "matthew@couchbase.com", "address": "11-21 Paul Street", "city": "London", "postCode": "EC2A 4JU", "telephone": "44-20-3837-9130", "orders": [ 1, 9, 698, 32 ] } u::1001::productsviewed { "productsList": [ 8, 33, 99, 100 ] }
  • 41. ©2015  Couchbase  Inc. 41 Compound  keys:  example u::1001 { "name": "Matthew Revell", "email": "matthew@couchbase.com", "address": "11-21 Paul Street", "city": "London", "postCode": "EC2A 4JU", "telephone": "44-20-3837-9130", "orders": [ 1, 9, 698, 32 ] } u::1001::productsviewed { "productsList": [ 8, 33, 99, 100 ] } p::8 { id": 1, "name": "T-shirt", "description": "Red Couchbase shirt", "quantityInStock": 99, "image": "tshirt.jpg” }
  • 42. ©2015  Couchbase  Inc. 42 Compound  keys:  example u::1001 { "name": "Matthew Revell", "email": "matthew@couchbase.com", "address": "11-21 Paul Street", "city": "London", "postCode": "EC2A 4JU", "telephone": "44-20-3837-9130", "orders": [ 1, 9, 698, 32 ] } u::1001::productsviewed { "productsList": [ 8, 33, 99, 100 ] } p::8 { id": 1, "name": "T-shirt", "description": "Red Couchbase shirt", "quantityInStock": 99 } p::8::img “http://someurl.com/tshirt.jpg”
  • 43. ©2015  Couchbase  Inc. 43 Demo: Code examples: CRUD Sample  code  for: § Create   § Read § Update § Delete
  • 45. ©2015  Couchbase  Inc. 45 Why  SQL  for  JSON? JSON Documents Provide RichStructure (Noassembly) StructureEvolution (Flexibleschema,easytochange) SQL Provides Generalqueryfunctionality Queryacrossrelationships Why N1QL? Mostdevelopersalreadyknow SQL Noneedforcomplexquery frameworks
  • 46. ©2015  Couchbase  Inc. 46 SELECT § Standard  SELECT  pipeline – SELECT,  FROM,  WHERE,  GROUP  BY,  ORDER  BY,  LIMIT,  OFFSET § Queries  across  relationships – JOINs – Subqueries – NEST  — a  JOIN  that  embeds  child  objects  within  their  parent – UNNEST  — a  JOIN  that  surfaces  nested  objects  as  top-­‐level  data § Aggregation § Set  operators – UNION,  INTERSECT,  EXCEPT
  • 47. ©2015  Couchbase  Inc. 47 Indexing § CREATE  /  DROP  INDEX § Two  types  of  indexes – View  indexes – GSI  indexes  (global  secondary  indexes) § Can  index  any  data  expression – Nested  /  complex  expressions – Computed  expressions § EXPLAIN
  • 48. ©2015  Couchbase  Inc. 48 Data  writes § UPDATE  …  WHERE  … – Partial  updates;  deep  updates § DELETE  …  WHERE  … – Deeply  nested  conditions § INSERT  …  VALUES  …;  INSERT  …  SELECT  … – Bulk  insert;  transfer  and  transformation § MERGE – INSERT  or  UPDATE;  ETL  support
  • 49. ©2015  Couchbase  Inc. 49 Document-­‐oriented  Extensions § Nested – Paths—user.profile.email,  children[0],  children[0:2] – NEST,  UNNEST – Ranging—EVERY  child.age  >  5  FOR child  IN children  END – Transformations—SELECT  {“name”:  first_name  ||  last_name} § Non-­‐uniform – IS  MISSING – Type  checking  and  conversion § Distributed – Direct  lookup—USE  KEYS – Efficient  joins—ON  KEYS
  • 50. ©2015  Couchbase  Inc. 50 Expressions ©2014  Couchbase,  Inc.   50 Expressions Literals q Primitives  [  0,  ‘hello’,  TRUE  ] q NULL Operators q Arithmetic  [ +,  -­‐,  *,  /, %  ] q Logical  [  AND,  OR, NOT  ] q Comparison  [  <,  <=,  =,  !=,  >=,  >,  BETWEEN,  IS  NULL  ] q Pattern  matching  [  LIKE  ] q Conditional  [  CASE  ] Scalar  functions q Numeric  [  trigonometric, ROUND,  TRUNC,  …  ] q String  [  UPPER,  LOWER, TRIM,  SUBSTR,  …  ] q Date  [ string  and  numeric  dates,  NOW,  date  arithmetic,  … ] Aggregate functions q MIN,  MAX,  SUM,  AVG, COUNT  [  DISTINCT  ] Subqueries q Subqueries are  full  expressions
  • 51. ©2015  Couchbase  Inc. 51 Document-­‐Oriented  Expression  Features ©2014  Couchbase,  Inc.   51 Features Ranging  over  collections WHERE  ANY c  IN  children  SATISFIES  c.age  >  10  END WHERE EVERY r  IN  ratings  SATISFIES  r  >  3  END Mapping  with  filtering ARRAY c.name  FOR  c  IN  children  WHEN c.age  > 10  END Deep  traversal and  update WHERE ANY  node  WITHIN request  SATISFIES  node.type  =  “xyz”  END UPDATE  doc  SET c.name  =  Title(c.name)  FOR  c  WITHIN doc  END Dynamic Construction SELECT  { “a”:  expr1,  “b”:  expr2  }  AS  obj1,  name  FROM  …  //  Dynamic  object SELECT  [  a,  b  ]  FROM  …  //  Dynamic array Nested  sourcing SELECT *  FROM  a.b.c  …  //  Select  from  nested  objects
  • 52. ©2015  Couchbase  Inc. 52 Demo: N1QL samples N1QL  Queries  from § Web  UI § Command  line  cbq § REST
  • 54. ©2015  Couchbase  Inc. 54 Develop  with  Agility With  Couchbase  Server,  you  can  Develop  Applications  with  Agility.  Here’s  why: Easier,  Faster  Development Flexible  Data  Modeling Powerful  Querying SQL  Integration  &  Migration Big  Data  Integration Mobile  /  IoT
  • 55. ©2015  Couchbase  Inc. 55 Operate  at  Any  Scale With  Couchbase  Server,  you  can  deploy,  manage,  and  scale  apps  without  limits.  Here’s  why: Elastic Scalability Consistent High Performance Always-on Availability Multi-Data Center Deployment Simple, Powerful Administration Enterprise Grade Security
  • 57. ©2015  Couchbase  Inc. 57 Additional  Resources 57 § Couchbase  Labs:  https://github.com/couchbaselabs § Sample  Applications: § https://github.com/couchbaselabs?utf8=%E2%9C%93&query=try § https://github.com/couchbaselabs?utf8=%E2%9C%93&query=beer § General  Docs:  http://docs.couchbase.com § Query  Portal:  http://query.couchbase.com § Blog:  http://blog.couchbase.com § Forum:  http://forums.couchbase.com
  • 58. ©2015  Couchbase  Inc. 58 beer-­‐sample travel-­‐sample node  1 192.168.56.101 node  2 192.168.56.102 Cluster  Madrid  prod airlines node  3 192.168.56.1013 Cluster  Backup XDCR airlines
  • 59. ©2015  Couchbase  Inc. 59 airlines node  3 192.168.56.1013 Cluster  Backup