Couchbase(1)Introduction and Installation

Couchbase(1)Introduction and Installation

1. Documents
Couchdb + Membase = Couchbase

Smart Client
load all the node information, decide which node to connect and fetch data.

vBucket - auto sharding
Improvement of these

servers = [ ‘server1:11211’, ‘server2:11211’, ‘server3:11211’]
server_for_key(key) = servers[hash(key) % servers.length]

key hash ——> vBucket ——>Servers

servers = [ ‘server1:11211’, ‘server2:11211’, ‘server3:11211’]
vbuckets = [0, 0, 1, 1, 2, 2]
server_for_key(key) = servers[vbuckets[hash(key) % buckets.length]]

Flexible Data Model
Native support for JSON documents, Indexing and Querying on JSON documents,

Easy Scalability
grow with auto-sharding, Cross-Cluster Replication

Consistent High Performance
object-level cache

2. Installation on MAC
I just download the app from this URL http://packages.couchbase.com/releases/2.5.1/couchbase-server-enterprise_2.5.1_x86_64.zip

3. Scala Client based on Java Client

Add the Client SDK jar dependencies
"com.couchbase.client"   % "couchbase-client"            % "1.4.0"


The Codes are as follow:
package com.sillycat.easynosqlscala.app

import java.net.URI;
import java.util.Arrays;
import java.util.List;
import com.couchbase.client.CouchbaseClient

object TestCouchBaseDBConnectionApp extends App {

  val hosts = Arrays.asList(
    new URI("http://127.0.0.1:8091/pools")
  );

  // Name of the Bucket to connect to
  val bucket = "default";

  // Password of the bucket (empty) string if none
  val password = "";

  // Connect to the Cluster
  val client = new CouchbaseClient(hosts, bucket, password);

  // Store a Document
  client.set("my-first-document", "Hello Couchbase!").get();

  // Retreive the Document and print it
  println(client.get("my-first-document"));

  // Shutting down properly
  client.shutdown();

}


References:
http://www.couchbase.com/
http://www.couchbase.com/couchbase-server/overview
http://www.couchbase.com/mobile#lite

Java SDK Client
http://www.couchbase.com/communities/java/getting-started
http://docs.couchbase.com/couchbase-sdk-java-1.4/
https://github.com/couchbase/couchbase-java-client

Tips
http://isysteam.blog.163.com/blog/static/201738094201206105114523
http://www.ccvita.com/440.html
http://blog.nosqlfan.com/tags/membase

http://zhang.hu/couchbase/
http://www.cnblogs.com/acodelife/archive/2013/02/27/2935441.html

Redis 1~ 6
http://sillycat.iteye.com/blog/1549504   Installation redis on windows, ubuntu, redhat
http://sillycat.iteye.com/blog/1553507   Data Type, String, Int, List, Set
http://sillycat.iteye.com/blog/1553508   Data Type, Ordered Set, Hash, Publish/Subscribe, Data Expiration
http://sillycat.iteye.com/blog/1553509   Java DAO Layer
http://sillycat.iteye.com/blog/2028180   Installation on MAC, HA Solution sentinel master slave
http://sillycat.iteye.com/blog/2033094   Scala Client



你可能感兴趣的:(Install)