DEV Community

Cover image for Installing Couchbase Database on Ubuntu 22.04
Sanskriti Harmukh for Vultr

Posted on with Aashish Chaurasiya • Originally published at docs.vultr.com

Installing Couchbase Database on Ubuntu 22.04

Couchbase is a distributed NoSQL database combining key-value and document-store functionality with a memory-first architecture for fast reads. This guide deploys a multi-node Couchbase cluster on Ubuntu 22.04 over a private network, fronts it with an Nginx reverse proxy, loads a sample dataset, runs N1QL queries, and sets up monitoring.

Prerequisites: a main Couchbase server (4GB RAM min) plus at least 2 additional nodes (4GB RAM min each), all attached to the same private network, a domain A record pointing at the main server (e.g. couchbase.example.com).


Install Couchbase

Run on the main server first, then repeat on each node.

$ ssh linuxuser@SERVER-IP
$ curl -O https://packages.couchbase.com/releases/couchbase-release/couchbase-release-1.0-noarch.deb
$ sudo dpkg -i ./couchbase-release-1.0-noarch.deb
$ sudo apt-get update
$ sudo apt-get install couchbase-server-community
$ service couchbase-server status
Enter fullscreen mode Exit fullscreen mode

Identify the private network interface and allow traffic on it:

$ ip a
Enter fullscreen mode Exit fullscreen mode

Note the interface carrying your private-network IP (e.g. enp8s0), then:

$ sudo ufw allow in on enp8s0
Enter fullscreen mode Exit fullscreen mode

Repeat the full install on every node before continuing.


Configure Nginx as a Reverse Proxy

Couchbase nodes talk to each other over private addresses; Nginx on the main server proxies external access without exposing backend ports directly.

$ sudo apt install nginx -y
$ sudo rm /etc/sites-enabled/default
$ sudo nano /etc/nginx/conf.d/couchbase.conf
Enter fullscreen mode Exit fullscreen mode
server {
    listen 80;
    server_name couchbase.example.com;

    location / {
        proxy_pass http://127.0.0.1:8091;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

# Couchbase Node 1

    location /node1 {
        proxy_pass http://10.50.96.3:8091;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

# Couchbase Node 2

    location /node2 {
        proxy_pass http://10.50.96.5:8091;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
Enter fullscreen mode Exit fullscreen mode

Replace the node IPs with your actual private addresses. / proxies to the main server; /node1, /node2 proxy to each additional node.

$ sudo nginx -t
$ sudo systemctl restart nginx
$ sudo ufw allow 80/tcp
$ sudo ufw reload
Enter fullscreen mode Exit fullscreen mode

Create the Cluster

Visit http://couchbase.example.com:

  1. Setup New Cluster — cluster name, admin username, strong password.
  2. Next: Accept Terms.
  3. Check the terms checkbox, Finish with Defaults.

Add Nodes to the Cluster

For each node, via its Nginx proxy path (e.g. http://couchbase.example.com/node1):

  1. Join Existing Cluster.
  2. Enter the main server's private IP as Cluster Host Name/IP Address, plus the admin username/password.
  3. Join Cluster.
  4. Back on the main server: ServersRebalance, wait for Rebalance Completed Successfully.

Repeat for every node.


Load a Sample Dataset

Couchbase ships 3 sample datasets.

  1. Bucketssample bucket (in the ADD BUCKET notification).
  2. Check travel-sample, Load Sample Data.

Inspect the Data

  1. BucketsDocuments next to travel-sample to browse records.
  2. Bucketstravel-sampleScopes & Collections to see the inventory scope and its collections, with per-collection document counts and memory/disk usage.

Run a Query

Couchbase uses N1QL (SQL-like) for querying documents.

  1. Query, paste:
SELECT name FROM `travel-sample`.inventory.hotel WHERE type = "hotel" AND city = "Paris" AND free_parking = true LIMIT 5;
Enter fullscreen mode Exit fullscreen mode
  1. Execute — results return as JSON, 5 matching hotel names.

Monitoring

  1. DashboardCluster Overview for active process stats, Node Resources for CPU/request-rate/memory per node.
  2. Build a custom dashboard: Choose Dashboard → new dashboard, name it, Save.
  3. Add a Chartcombine node data + multiple stats per chart → pick stats (e.g. Available RAM, Swap Used under one tab, Query Execution Time and Queries > 500ms under Query) → Save Chart.

Next Steps

Couchbase is running as a multi-node cluster over your private network, proxied through Nginx, with sample data loaded and query access confirmed. From here:

  • Set up XDCR (cross-datacenter replication) for multi-region durability
  • Configure bucket-level replica counts for higher availability
  • Explore the Couchbase SDKs to connect application code instead of the web console

For the full guide, visit the original article on Vultr Docs.

Top comments (0)