Databases Reference
In-Depth Information
8.5
Case study: using Couchbase
as a high-availability document store
Couchbase 2.0 is a JSON document store that uses many of the same replication pat-
terns found in other NoSQL databases.
Couchbase vs. CouchDB
Couchbase technology shouldn't be confused with Apache CouchDB. Though both
are open source technologies, they're separate open source projects that have sig-
nificantly different capabilities, and they support different application developer
needs and use cases. Under the covers, Couchbase has more in common with the
original Memcached project than the original CouchDB project. Couchbase and
CouchDB share the same way of generating views of JSON documents, but their
implementations are different.
Like Cassandra, Couchbase uses a peer-to-peer distribution model, where all nodes
provide the same services, thus eliminating the possibility of a single point of failure.
Unlike Cassandra, Couchbase uses a document store rather than a column family
store, which allows you to query based on a document's content. Additionally, Couch-
base uses the keyspace concept that associates key ranges with individual nodes.
Figure 8.7 shows the components in a multidata-center Couchbase server.
Couchbase stores document collections in containers called buckets , which are config-
ured and administered much like folders in a filesystem. There are two types of buckets:
a memcached bucket (which is volatile and resides in RAM ), and a Couchbase bucket,
Data center: US West
Data center: US East
App server
App server
App server
App server
Couchbase client
Couchbase client
Couchbase client
Couchbase client
Cluster map
Cluster map
Cluster map
Cluster map
1
Active
Active
Active
Active
doc
doc
doc
doc
doc
doc
doc
doc1
XDCR
2
Replicas
doc
Replicas
Replicas
Replicas
doc
3
doc
doc
doc
doc
doc1
doc1
Data server 1
Data server 2
Data server 3
Data server 4
Figure 8.7 High-availability documents in Couchbase. Couchbase buckets are logical
collections of documents that are configured for high availability. Couchbase clients use
cluster maps to find the physical node where the active version of a document is stored.
The cluster map directs the client to a file on the active node (1). If Data server 1 is
unavailable, the cluster map will make a replica of doc1 on Data server 2 the active version
(2). If the entire US West data center goes down, the client will use cross data center
replication (XDCR) and make a copy on Data server 3 active (3) from the US East region.
Search WWH ::




Custom Search