how-to nosql webinars - couchbase 101

28
Justin Michaels [email protected] Solution Architect Couchbase 101 Server Fundamentals

Upload: couchbase

Post on 07-Jul-2015

1.171 views

Category:

Technology


1 download

DESCRIPTION

Review the basics of the Couchbase software. We will take you through topics including installation of Couchbase on various platforms, setup and configuration parameters, monitoring, scaling, and the Admin console.

TRANSCRIPT

Page 1: How-to NoSQL webinars - Couchbase 101

Justin [email protected]

Solution Architect

Couchbase 101 Server Fundamentals

Page 2: How-to NoSQL webinars - Couchbase 101
Page 3: How-to NoSQL webinars - Couchbase 101

Evolution of Couchbase

Founders were key contributors to memcached

Evolved into Membase, a distributed key-value cache

Original contributors to CouchDB re-wrote storage engine to create Couchbase Server

Couchbase Server is a cache and persistence engine in a single easy to scale distributed database.

Page 4: How-to NoSQL webinars - Couchbase 101

Couchbase Server Core Principles

Easy Scalability

Consistent High Performance

Always On 24x365

Grow cluster without application changes, without downtime with a single click

Consistent sub-millisecond read and write response times

with consistent high throughput

No downtime for software upgrades, hardware maintenance, etc.

Flexible Data Model

JSON Anywhere document model with no fixed schema.

Page 5: How-to NoSQL webinars - Couchbase 101

INSTALL SERVER

Page 6: How-to NoSQL webinars - Couchbase 101

Install on Amazon via AMI

Page 7: How-to NoSQL webinars - Couchbase 101

Download Couchbasewww.couchbase.com/download

Page 8: How-to NoSQL webinars - Couchbase 101

1. Run what you downloaded

2. Installs to /opt/couchbase

3. Access <ip>:8091 via http

*CLI and scripted deployments available*

Let’s see a deployment

Page 9: How-to NoSQL webinars - Couchbase 101

ARCHITECTURE

Page 10: How-to NoSQL webinars - Couchbase 101

Couchbase Node

Hea

rtb

eat

Pro

cess

mo

nit

or

Glo

bal

sin

glet

on

su

per

viso

r

Co

nfi

gura

tio

n m

anag

er

httpR

EST

man

age

me

nt

AP

I/W

eb

UI

HTTP

8091Erlang port mapper

4369Distributed Erlang

21100 - 21199

Erlang/OTP

storage interface

Couchbase EP Engine

11210Memcapable 2.0

Moxi

11211Memcapable 1.0

Memcached

New Persistence Layer

8092Query API

Qu

ery

En

gin

e

Data Manager Cluster ManagerServer/Cluster

Management & Communication

(Erlang)

RAM Cache, Indexing & Persistence

Management(C)

Page 11: How-to NoSQL webinars - Couchbase 101

Couchbase Node

New Persistence Layer

storage interface

Couchbase EP Engine

11210Memcapable 2.0

Moxi

11211Memcapable 1.0

Object-level Cachememcached

Disk Persistencecouchstore

8092Query API

Qu

ery

En

gin

e

HTTP

8091Erlang port mapper

4369Distributed Erlang

21100 - 21199

Hea

rtb

eat

Pro

cess

mo

nit

or

Co

nfi

gura

tio

n m

anag

er

http

RES

T m

anag

em

en

t A

PI/

We

b U

I

Erlang/OTP

Data Manager

Cluster Manager

Page 12: How-to NoSQL webinars - Couchbase 101

Couchbase Data• Key is any string up to 250 Bytes

• Similar to primary key

• Must be unique within a bucket

• ID based document lookup is extremely fast

• Value can be up to 20mb

• Simple Datatypes: strings, numbers, datetime, boolean, binary

• Complex Datatypes: dictionaries/hashes, arrays/lists, can be stored in JSON format

• JSON: Automatically checked by the server

• BLOB: Array of bytes

• Cluster Aware Clients (Smartclient SDK)

PythonRuby

Page 13: How-to NoSQL webinars - Couchbase 101

Couchbase Data

meta{

“id”: “u::tesla”,“rev”: “1-0002bce0000000000”,“flags”: 0,“expiration”: 0,“type”: “json”

}

document{

“sellerid”: 123456,“type”: “car”,“style”: “sedan”,“year”: 2013,“trim”: “performance”,“model”: “s”

}

Server stores metadata with each key/value pair

(document)

Unique and Kept in RAM

Document Value

Most Recent In RAM And Persisted To Disk

Page 14: How-to NoSQL webinars - Couchbase 101

CLUSTER MECHANICS

Page 15: How-to NoSQL webinars - Couchbase 101

33 2

Write (‘set’) Operation2

Managed Cache

Dis

k Q

ueu

e

Disk

Replication Queue

App Server

Couchbase Server Node

Doc 1Doc 1

Doc 1

To other nodeManaged Cache

Node

Page 16: How-to NoSQL webinars - Couchbase 101

GET

Do

c 1

33 2

Read (‘get’) Operation2

Dis

k Q

ueu

e

Replication Queue

App Server

Couchbase Server Node

Doc 1

Doc 1Doc 1

Managed Cache

Disk

To other nodeManaged Cache

Node

Page 17: How-to NoSQL webinars - Couchbase 101

33 2

Cache Ejection2

Dis

k Q

ueu

e

Replication Queue

App Server

Couchbase Server Node

Doc 1

Doc 6Doc 5Doc 4Doc 3Doc 2

Doc 1

Doc 6 Doc 5 Doc 4 Doc 3 Doc 2

Managed Cache

Disk

To other nodeManaged Cache

Node

Page 18: How-to NoSQL webinars - Couchbase 101

33 2

Cache Miss2

Dis

k Q

ueu

e

Replication Queue

App Server

Couchbase Server Node

Doc 1

Doc 3Doc 5 Doc 2Doc 4

Doc 6 Doc 5 Doc 4 Doc 3 Doc 2

Doc 4

GET

Do

c 1

Doc 1

Doc 1

Managed Cache

Disk

To other nodeManaged Cache

Node

Page 19: How-to NoSQL webinars - Couchbase 101

Cluster MechanicsFailover

User Configured Replica Count = 1

SERVER 4

Replica

Active

App Server 1

COUCHBASE Client Library

CLUSTER MAP

COUCHBASE Client Library

CLUSTER MAP

App Server 2

Couchbase Server Cluster

Active

SERVER 1

Doc 5

Doc 2

Doc 9Doc

Doc

Doc

Replica

Doc 4

Doc 1

Doc

Doc

Active

SERVER 2

Doc 4

Doc 7 Doc 8

Doc

Doc

Replica

Doc 6

Doc 3 Doc 2

Doc

Doc

Active

SERVER 3

Doc 1

Doc 3

Doc

Doc

Replica

Doc 7

Doc 9

Doc 5Doc

Doc

Doc

• App servers accessing docs. For this example only a small subset of the documents in 1024 partitions are shown.

• Requests to Server 3 begin to fail

• The Cluster detects the failure and initiates a failover if autofailover is enabled. –Promotes replicas of object to

active from Memory. The replica vBuckets on Disk are also promoted to active.

–Updates cluster map and smart client is immediately aware.

• Requests for docs now go to appropriate server

• Typically a rebalance would follow, but is not required.

• Rebalance is an online operation

Doc 1 Doc 3

Doc

Page 20: How-to NoSQL webinars - Couchbase 101

Client Interaction with Couchbase

or vBucket

Page 21: How-to NoSQL webinars - Couchbase 101

Client Interaction with Couchbase

CRC32("tesla") => Partition[0..1023] {962}ClusterMap[P(962)] => [x.x.x.x] => IP of Server Responsible for Partition 962

or vBucket

Page 22: How-to NoSQL webinars - Couchbase 101

Add CapacityOnline Operation

or vBucket

CRC32("tesla") => Partition[0..1023] {962}ClusterMap[P(962)] => [x.x.x.x] => IP of Server Responsible for Partition 962

Page 23: How-to NoSQL webinars - Couchbase 101

Add CapacityTwo More Nodes

or vBucket

Page 24: How-to NoSQL webinars - Couchbase 101

All Metadata for All Documents

(64 bytes + Key Length)

Document Values(NRU Ejected if RAM Quota

Used > 90%)

Also Leave RAM For OS:

[Filesystem Cache, Views and Data Center Replication]

Document Indexing

Monitoring

XDCR

Recommended:

minimum 4 Cores+ 1 core per design document

+ 1 core per replicated bucket across data centers

(XDCR)

Persisted Documents

All Indexes for Design Documents/Views

Append-Only Disk Format& Compaction

Performance:

Multiple EBS Volumes High IOPS Raid 0 on Amazon

RAM, CPU and IO Guidelines

RAM CPU Disk IO

Page 25: How-to NoSQL webinars - Couchbase 101

MONITORING

http://blog.couchbase.com/monitoring-couchbase-cluster

Page 26: How-to NoSQL webinars - Couchbase 101

Couchbase Monitoring

Page 27: How-to NoSQL webinars - Couchbase 101

DEMO

Let’s grow an online cluster and monitor progress

Page 28: How-to NoSQL webinars - Couchbase 101