How to install Couchbase on CentOS 8

Share on Social Media

Couchbase is a NoSQL document-oriented database management system. In this guide, you will learn how to install Couchbase on CentOS 8. #centlinux #linux #nosql

What is Couchbase? :

Couchbase server, originally known as Membase, is an open-source, distributed (shared-nothing architecture) multi-model NoSQL document-oriented database software.

Couchbase server is optimized for interactive applications. These applications may serve many concurrent users by creating, storing, retrieving, aggregating, manipulating and presenting data.

In support of these kinds of application needs, Couchbase database is designed to provide easy-to-scale key-value or JSON document access with low latency and high sustained throughput. It is designed to be clustered from a single machine to very large-scale deployments spanning many machines.

A query language called the non-first normal form query language, N1QL (pronounced nickel), is used for manipulating the JSON data in Couchbase database, just like SQL manipulates data in RDBMS. It has SELECT, INSERT, UPDATE, DELETE, MERGE statements to operate on JSON data. It was announced in March 2015 as “SQL for documents”. (Courtesy: Wikipedia)

Environment Specification:

We are using a minimal CentOS 8 virtual machine with following specifications.

  • CPU – 3.4 Ghz (1 cores)
  • Memory – 3 GB
  • Storage – 20 GB
  • Operating System – CentOS 8.2
  • Hostname – couchbase-01.centlinux.com
  • IP Address – 192.168.116.206 /24

Update Linux Software Packages:

Use a SSH client and connect with couchbase-01.centlinux.com as root user.

As per best practice, we always recommend to update the existing software packages on CentOS 8 operating system, and then install any new software on that server.

Execute dnf command to update existing software packages on CentOS 8.

# dnf update -y
Last metadata expiration check: 0:00:20 ago on Sun 06 Sep 2020 07:39:54 PM PKT.
Dependencies resolved.
Nothing to do.
Complete!

Our Linux operating system is already up-to-date, so there is nothing to update right now. The output may vary on your server machine.

Disable Transparent HugePages:

Transparent HugePages are enabled by default in CentOS / RHEL 8. But it harms the performance of Couchbase database.

Therefore, it is required that, you should disable Transparent HugePages on your Linux operating system before installing the NoSQL database server.

Check the current status of Transparent HugePages.

# cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never

As expected, Transparent HugePages are already enabled in our Linux operating system.

To disable Transparent HugePages, you have to edit GRUB boot menu. For this purpose, edit the GRUB configuration file in vim text editor.

# vi /etc/default/grub

Locate GRUB_CMDLINE_LINUX and append “transparent_hugepage=never” at the end of line.

GRUB_CMDLINE_LINUX="resume=/dev/mapper/cl-swap rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet transparent_hugepage=never"

Generate new GRUB boot menu based on customized configuration file.

# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
done

Restart Linux operating system to apply new settings.

# systemctl reboot

After restart, check the status of HugePages again.

# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]

You have disabled Transparent HugePages on your Linux operating system. But you are also required to configure tuned service as well.

tuned service is used for monitoring and tuning in a Linux system. tuned service can be used to disable or enable Transparent HugePages.

Therefore, we need to create a profile for tuned service and disable the Transparent HugePages in that profile.

Create a directory for new tuned profile.

# mkdir /etc/tuned/no-thp

Create a tuned configuration file.

# vi /etc/tuned/no-thp/tuned.conf

Add following lines in that file.

[main]
include=virtual-guest

[vm]
 transparent_hugepages=never 

Enable the no-thp profile by using following command.

# tuned-adm profile no-thp

Change Swappiness in CentOS / RHEL 8:

The Linux kernel’s swappiness setting defines how aggressively it will swap memory pages versus dropping pages from the page cache.

A higher value increases swap aggressiveness, while a lower value tells the Linux kernel to swap as little as possible to disk and favor RAM.

The swappiness range is from 0 to 100, and most Linux distributions have swappiness set to 60 by default.

Couchbase Database Server is optimized with its managed cache to use RAM, and is capable of managing what should be in RAM and what shouldn’t be. Allowing the Linux operating system to have too much control over what memory pages are in RAM is likely to lower your NoSQL database performance. Therefore, it’s recommended that swappiness should be set to 0.

Check current setting of swappiness.

# cat /proc/sys/vm/swappiness
60

Set the swappiness setting to 0 for the running system.

# sysctl -w vm.swappiness=0
vm.swappiness = 0

Verify the current setting of swappiness again.

# cat /proc/sys/vm/swappiness
0

To make swappiness setting persistent, we have to add it in Kernel parameter file.

# echo 'vm.swappiness=0' >> /etc/sysctl.d/99-swappiness.conf

Install Couchbase Yum Repository:

Couchbase software is provided through their official yum repository.

Therefore, you are required to install Couchbase yum repository first on your Linux operating system.

# dnf install -y https://packages.couchbase.com/releases/couchbase-release/couchbase-release-1.0-x86_64.rpm

Build cache for newly installed yum repositories.

# dnf makecache
CentOS-8 - AppStream                            7.3 kB/s | 4.3 kB     00:00
CentOS-8 - Base                                 6.2 kB/s | 3.9 kB     00:00
CentOS-8 - Extras                               3.7 kB/s | 1.5 kB     00:00
Couchbase Server                                 52 kB/s | 119 kB     00:02
Couchbase Server (Community Edition)             29 kB/s | 106 kB     00:03
Couchbase SDK package repository                8.2 kB/s | 6.7 kB     00:00
Metadata cache created.

Install Couchbase on CentOS 8:

You have already added required yum repository, therefore, you can now easily install Couchbase on CentOS 8 server by using dnf command.

# dnf install -y couchbase-server
Last metadata expiration check: 0:53:49 ago on Sun 06 Sep 2020 07:48:23 PM PKT.
Dependencies resolved.
================================================================================
 Package              Arch       Version             Repository            Size
================================================================================
Installing:
 couchbase-server     x86_64     6.6.0-7909          couchbase-server     361 M
Installing dependencies:
 bzip2                x86_64     1.0.6-26.el8        BaseOS                60 k

Transaction Summary
================================================================================
Install  2 Packages

Total download size: 361 M
Installed size: 847 M
Downloading Packages:
(1/2): bzip2-1.0.6-26.el8.x86_64.rpm            271 kB/s |  60 kB     00:00
(2/2): couchbase-server-enterprise-6.6.0-centos 1.0 MB/s | 361 MB     05:56
--------------------------------------------------------------------------------
Total                                           1.0 MB/s | 361 MB     05:57
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Installing       : bzip2-1.0.6-26.el8.x86_64                              1/2
  Running scriptlet: couchbase-server-6.6.0-7909.x86_64                     2/2
Minimum RAM required  : 4 GB
System RAM configured : 2.63 GB

Minimum number of processors required : 4 cores
Number of processors on the system    : 1 cores


  Installing       : couchbase-server-6.6.0-7909.x86_64                     2/2
  Running scriptlet: couchbase-server-6.6.0-7909.x86_64                     2/2

You have successfully installed Couchbase Server.
Please browse to http://couchbase-01.centlinux.com:8091/ to configure your server.
Refer to http://docs.couchbase.com for additional resources.

Please note that you have to update your firewall configuration to
allow external connections to a number of network ports for full
operation. Refer to the documentation for the current list:
https://docs.couchbase.com/server/6.6/install/install-ports.html

By using this software you agree to the End User License Agreement.
See /opt/couchbase/LICENSE.txt.


  Verifying        : bzip2-1.0.6-26.el8.x86_64                              1/2
  Verifying        : couchbase-server-6.6.0-7909.x86_64                     2/2

Installed:
  bzip2-1.0.6-26.el8.x86_64          couchbase-server-6.6.0-7909.x86_64

Complete!

You have learned to install Couchbase on CentOS 8.

Set Process & File Descriptors Limits:

The default process and file descriptor limits are not sufficient for couchbase user. Therefore, you have to explicitly increase these limits.

Create a configuration file in /etc/security/limits.d directory by using vim text editor.

# vi /etc/security/limits.d/couchbase.conf

And add following settings therein.

couchbase      soft    nproc           10000
couchbase      hard    nproc           10000
couchbase      soft    nofile          70000
couchbase      hard    nofile          70000

Configure Linux Firewall:

Couchbase database uses following service ports.

  • 8091/18091 – Cluster Administration Console (HTTP/HTTPS)
  • 8092/18092 – Views and XDCR Access (HTTP/HTTPS)
  • 8093/18093 – Query Service (HTTP/HTTPS)
  • 8094/18094 – Search Service (HTTP/HTTPS)
  • 8095/18095 – Analytics Service (HTTP/HTTPS)
  • 8096/18096 – Eventing Service (HTTP/HTTPS)
  • 9140 – Eventing Service Debugger
  • 11210,11211,11207 – Data Service

Therefore, you need to allow incoming traffic to these ports, to make them accessible across the network.

# firewall-cmd --permanent --add-port={8091-8096,9140,11210,11211,11207,18091-18096}/tcp
success
# firewall-cmd --reload
success

Configuring Couchbase Server:

Open URL http://couchbase-01.centlinux.com:8091 in a web browser.

Configuring Couchbase Server

Since, you are accessing Couchbase web console for the first time, therefore, you are being asked to setup this cluster node.

If you are already running a Couchbase cluster, then you can add this node to your existing cluster.

Because you don’t have any Couchbase cluster, therefore, you have to create a new cluster.

Click on ‘Setup New Cluster’.

Configuring Couchbase Server - New Cluster 1

Provide information to create a new cluster and click on ‘Next: Accept Terms’.

Configuring Couchbase Server - New Cluster 2

Read and accept the license agreement and click on ‘Configure Disk, Memory, Services’.

Configuring Couchbase Server - New Cluster 3

Change settings here according to your requirement. Don’t worry, you can also change these settings later from the web interface.

Click on ‘Save & Finish’.

Configuring Couchbase Server - Dashboard

You will be redirected to the Dashboard. It is currently empty, because there isn’t any bucket created yet.

Click on ‘Settings > Sample Buckets’.

Configuring Couchbase Server - Settings

Choose a sample and click on ‘Load Sample Data’.

Go back to Dashboard again.

Configuring Couchbase Server - Dashboard

Now, you can see some graphs based on the sample data.

Conclusion – Install Couchbase on CentOS 8:

In this guide, you have learned how to install Couchbase on CentOS 8. Before you start using it, we recommend that you should buy and read Pro Couchbase Server 2nd Edition (PAID LINK) by Apress. This book will help you in understanding the NoSQL document-oriented database management system.

Scroll to Top