Working with Couchbase

1 hour
  • 3 Learning Objectives

About this Hands-on Lab

In this hands-on lab, we will install and initialize a Couchbase server on CentOS 7. Once that is complete, we will create a bucket and create some test data.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Install Couchbase
  1. Get the Couchbase RPM for version 6 and install it:

    sudo yum install -y couchbase-server-community-6.0.0-centos7.x86_64.rpm 
  2. Set the file limits in the limits.conf file:

    sudo vim /etc/security/limits.conf

    Add these lines:

    * soft nofile 75000
    * hard nofile 75000
  3. Start the Couchbase server:

    sudo /opt/couchbase/bin/couchbase-server -- -noinput -detached 
Create the Bucket and Test Data
  1. From the GUI, simply add bucket.

  2. From the CLI

    couchbase-cli bucket-create -c --username Administrator --password Omgpassword! --bucket testdata --bucket-type couchbase --bucket-ramsize 128
  3. Connect to couchbase using cbq

     cbq -e -u=Administrator
  4. Locate the data in the ~/data folder. There is a formatted version and there is an unformatted version. Either way, create a query from this data and run it against the bucket.

    {"name":"Donald Duck",
    {"name":"Jimmy James",
    {"name":"Han Solo",
    {"name":"Chew Bacca",
Confirm the Data Was Created Correctly
  1. In the GUI, the bucket will show the documents that were created, however, to make the bucket searchable, you will need to create an index:

    CREATE PRIMARY INDEX `td_idx` ON `testdata`;

    Then confirm that the data can be queried:

    Select * from `testdata`;

Additional Resources

In this hands-on lab, you will be tasked with standing up a single Couchbase instance on CentOS7.
Once this is done, you will need to create some test data in a bucket named testdata.
This data has been provided to you by the development team in the cloud_user's home directory in a folder named data.
They have provided both raw and formatted data.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?