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.

How to install Couchbase Server on CentOS 8

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 Training: MongoDB – The Complete Developer’s Guide 2025 from Maximilian Schwarzmüller

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

Output:

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

Output:

[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

Output:

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

Output:

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

Output:

60

Set the swappiness setting to 0 for the running system.

sysctl -w vm.swappiness=0

Output:

vm.swappiness = 0

Verify the current setting of swappiness again.

cat /proc/sys/vm/swappiness

Output:

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

Output:

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

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
firewall-cmd --reload

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.

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.

From setting up scalable AWS solutions to managing complex Linux environments, I’ve got you covered. Visit my Fiverr profile to get started.

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

Exit mobile version