Couchbase – setup a simple 3 node cluster

Couchbase is a Document Database, Key/Value Store, Distributed Cache; it is faster than MongoDB for NoSQL.

For testing purposes we will setup 3 kvm entities (on different hosts) because Couchbase’s primary purpose is to run in-memory operations.

Prerequisites:

Our testing raid_0 volume group is soft raid 0 with SSD caching for higher IOPS.
Now proceed to install the VMs:

for i in {1..3}; do ssh root@vmhost0$i \
lxc-create --template=centos --name=couchbase0$i --bdev=lvm --vgname=raid_0 --fssize=25G --thinpool=thin_pool_primary ;done

 

Create DNS records for all involved machines

For this use your already installed DNS servers or /etc/hosts

 

Install Couchbase

for i in {1..3}; do ssh root@couchbase0$i \
wget -O http://packages.couchbase.com/releases/couchbase-release/couchbase-release-1.0.0-x86_64.rpm \
/root/couchbase-release-1.0.0-x86_64.rpm && \
yum localinstall /root/couchbase-release-1.0.0-x86_64.rpm ;done

for i in {1..3}; do ssh root@couchbase0$i \
yum clean all && yum install -y couchbase-server-community ;done

for i in {1..3}; do ssh root@couchbase0$i \
yum install -y openssl ;done

for i in {1..3}; do ssh root@couchbase0$i \
systemctl enable couchbase-server && systemctl start couchbase-server ; done

 

Initialize the cluster

Open your browser and enter: http://couchbase01.example.com:8091/

In the URL, represents the name or IP address of the computer that hosts Couchbase Server. If Couchbase Server is running locally, enter localhost for the host name.

Click Setup.

On the Configure Server screen, click Next to accept the default values for a new cluster with only one exception, /data for storage and 3 replica sets.

On the Sample Buckets screen, under Available Samples select the one sample we will use later in this tutorial:  travel-sample and click Next.

On the Create Default Bucket screen, under Memory Size set the Per Node RAM Quota to 100 MB and click Next.

On the Notifications screen, enter your registration information, agree to the terms and conditions, and click Next.

On the Configure Server screen, enter and verify a password for the Administratoraccount, and click Next.

The Couchbase Web Console opens and displays the Cluster Overview.

While the Couchbase Web Console is open, click on the tabs in the top menu and look at the screens to familiarize yourself with the information and available options.

 

Join the other 2 nodes in the cluster

Open your browser and enter: http://couchbase02.example.com:8091/  , click join an existing cluster, should be intuitive. Now do the same with http://couchbase03.example.com:8091/

 

Rebalance and make sure your cluster is ready

Open your browser and enter: http://couchbase01.example.com:8091/ then go to Server Nodes tab and click Rebalance. It should not take long as travel-sample contains little data.

For safety you should enable Auto-failover from Settings tab -> Auto-failover tab.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s