Couchbase provides high availability and disaster recovery in several ways:

This blog will show how to create a Couchbase cluster using Couchbase Command Line Interface (CLI). In addition, these steps can also be performed using the Couchbase REST API and the Couchbase Web Console.

couchbase-cluster-amazon

Couchbase nodes in a cluster are homogeneous. Applications can write to any node and read from any node. There is no write-to-master and read-from-slave architecture that inherently gives you scalability problems. This allows the Couchbase cluster to truly scale horizontally to meet your growing application demands.

Creating a Couchbase cluster involves the following steps:

  • Provision Couchbase: Provision 1 or more Couchbase nodes, say on Amazon Web Services
  • Initialize master: Initialize any node to be the “master” of the cluster by calling cluster-init CLI command
  • Create cluster: For all other nodes, create a cluster by invoking the server-add CLI command
  • Rebalance cluster: Finally, rebalance the cluster by calling the rebalance CLI command

Provision Couchbase

Provision a Couchbase node on Amazon:

Security group name is explained in Couchbase Cluster on Amazon using CLI. Let's call this node as “master”.

Initialize Couchbase “master”

Configure the “master” instance and initialize the cluster:

Create another instance, lets call it “worker”. Note, this is not a master/slave architecture. Couchbase cluster is homogenous where any node in the cluster can be “master”.

Create Couchbase Cluster

Add this newly created “worker” instance to the cluster:

Typically, you'll create and add multiple nodes to the cluster before rebalancing.

Rebalance Couchbase Cluster

Rebalance the cluster:

Now, you can create as many instances and easy include them in the cluster. Adding a single node and rebalancing the cluster can be easily done as a single step:

Now, your cluster is accessible at http://:8091 or http://:8091. Further references …

Enjoy!

Posted by Arun Gupta, VP, Developer Advocacy, Couchbase

Arun Gupta is the vice president of developer advocacy at Couchbase. He has built and led developer communities for 10+ years at Sun, Oracle, and Red Hat. He has deep expertise in leading cross-functional teams to develop and execute strategy, planning and execution of content, marketing campaigns, and programs. Prior to that he led engineering teams at Sun and is a founding member of the Java EE team. Gupta has authored more than 2,000 blog posts on technology. He has extensive speaking experience in more than 40 countries on myriad topics and is a JavaOne Rock Star for three years in a row. Gupta also founded the Devoxx4Kids chapter in the US and continues to promote technology education among children. An author of several books on technology, an avid runner, a globe trotter, a Java Champion, a JUG leader, NetBeans Dream Team member, and a Docker Captain, he is easily accessible at @arungupta.

Leave a reply