What is Couchbase



Couchbase is an open-source document−oriented NoSQL database. It stores the information in key−value format, more specifically like a JSON document. We use Couchbase for horizontal scaling. To learn more about Couchbase, visit the official site by clicking here.

Installation Guide

Since this tutorial will be working extensively with Couchbase. Make sure it is installed on your machine, If not you can install it from here based on your system configuration.

Steps Post Installation

Once it is installed, it will navigate us to the URL − http://localhost:8091/index.html

Create Cluster

It will ask to set up the cluster, Click to create a new one, It will look like: Now, It −

Cluster Setup

Now, It will ask to accept Terms and condition −

Cluster Setup Accepttandc

Accept it and click on Configure Disk, Memory, Services (You can also click on Finish with defaults, if don't want to configure).

Clustersetup Configure3

See if configurations like disk and memory need to be changed, Once done click on Save and Finish. The final screen will be −

Dasboard

Create Bucket

Once the cluster setup is done we need to create a bucket. Click on Buckets and then click on ADD BUCKET. Enter a name for Bucket, Here we have given Tutorials_Point

Create Bucket5

What is Bucket in the Couchbase?

A Bucket in the Couchbase is similar to the Table in RDBMS, or equivalent to a Collection in the MongoDB database. The bucket keeps holds of documents.

Create Primary Index

By default custom queries will be processed using the N1QL engine, If we are using Couchbase 4.0 or later. We must need to create a primary index on the bucket, to add support for N1QL. To create primary index Click on Query and then type below command in Query Editor

CREATE PRIMARY INDEX ON Tutorials_Point USING GSI;

In the above command, Tutorials_Point is our Bucket name, GSI is a global secondary index, and GSI is majorly used for optimizing Adhoc N1QL queries.

Advertisements