Site icon CentLinux

How to install Couchbase Server on CentOS 8

Share on Social Media

Learn how to install Couchbase Server on CentOS 8 with our comprehensive guide. Follow step-by-step instructions to set up and configure Couchbase for optimal performance on your Linux system. #centlinux #linux #nosql

What is Couchbase?

Couchbase is a distributed, NoSQL, document-oriented database management system that is designed for interactive applications. It combines the flexibility of JSON data modeling with a distributed architecture for performance, scalability, and high availability. Here are some key points about Couchbase:

  1. NoSQL Database: Couchbase is classified as a NoSQL database because it does not rely on the traditional relational database model. Instead, it stores data in a flexible JSON format, allowing for dynamic schemas and easier integration with modern application development practices.
  2. Key-Value Store and Document Database: It functions as both a key-value store and a document database. Data is stored as JSON documents, which can be queried using SQL-like language (N1QL) or accessed directly via key-value operations.
  3. Distributed Architecture: Couchbase employs a distributed architecture with built-in replication, sharding, and automatic failover capabilities. This enables horizontal scaling across multiple nodes to handle large volumes of data and high request rates.
  4. High Performance: It is designed to deliver high performance with low latency, capable of handling thousands to millions of operations per second depending on the deployment configuration.
  5. Built-in Caching: Couchbase includes an integrated caching layer that leverages memory-optimized storage for frequently accessed data. This enhances read and write performance by reducing disk I/O.
  6. Multi-Cluster Global Replication: Supports cross-datacenter replication (XDCR) for creating geographically distributed clusters, ensuring data consistency and disaster recovery.
  7. Use Cases: Couchbase is used in various applications such as real-time analytics, content management, user profile management, recommendation engines, and IoT data management where flexibility, scalability, and performance are critical.

Overall, Couchbase provides a scalable and flexible database solution for modern applications that require fast access to large volumes of diverse data types.

Couchbase vs MongoDB

Couchbase and MongoDB are both popular NoSQL databases, each with its own strengths and features. Here’s a comparison between the two:

Couchbase

Data Model:

Architecture:

Query Language:

Use Cases:

MongoDB

Data Model:

Architecture:

Features:

Use Cases:

Summary

Choosing between Couchbase and MongoDB depends on specific project requirements, such as performance needs, data structure complexity, and scalability demands. Both databases excel in different areas, catering to diverse use cases in modern application development.

Recommended Online Training: MongoDB – Learn NoSQL Databases – Complete Bootcamp

Environment Specification

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

Read Also: How to install CockroachDB Cluster on CentOS 8

Update your Linux Server

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 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 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 Server 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.

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.

Couchbase Cluster Setup

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’.

Couchbase – Setup New Cluster

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

Couchbase – Terms and Conditions

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

Configure Couchbase Cluster

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’.

Couchbase 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’.

Couchbase Settings

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

Go back to Dashboard again.

Couchbase Dashboard – Sample Data

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

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.

Final Thoughts

Setting up Couchbase Server on CentOS 8 opens up powerful possibilities for scalable, high-performance data management in your applications. With its flexible JSON data model and distributed architecture, Couchbase is an excellent choice for projects requiring real-time analytics, content management, and more.

If you need guidance or assistance with installing Couchbase Server on CentOS 8, I provide expert services to ensure a smooth setup process. Check out my Fiverr gig for detailed instructions and personalized support: Linux System Admin

Let’s get your Couchbase deployment up and running efficiently!

Exit mobile version