Key Features of Couchbase
System Requirements
⚠️ Important: Couchbase is memory-intensive. It requires at least 4 GB of RAM for the data service alone. For clusters running multiple services, allocate additional memory accordingly.
Resource Requirements
| Workload | RAM | CPU | Storage | RamNode Plan |
|---|---|---|---|---|
| Development/Testing | 4 GB | 2 vCPUs | 40 GB SSD | Premium 4GB |
| Light Production | 8 GB | 4 vCPUs | 80 GB SSD | Premium 8GB |
| Standard Production | 16 GB | 6 vCPUs | 160 GB SSD | Premium 16GB |
| High Performance | 32 GB+ | 8+ vCPUs | 320 GB+ SSD | Premium 32GB+ |
Network Ports
| Port | Service | Description |
|---|---|---|
| 8091 | Web Console | Cluster management UI and REST API |
| 8093 | Query | N1QL query service |
| 8094 | Search | Full-text search service |
| 11210 | Data | Client data operations (memcached) |
| 18091-18096 | SSL Services | Encrypted versions of services |
Installation
sudo apt update && sudo apt upgrade -ysudo apt install -y wget curl apt-transport-https gnupg2Download and Install Couchbase Server
Download the latest Couchbase Server package (Community Edition 7.6):
# Download Couchbase Server
wget https://packages.couchbase.com/releases/7.6.0/couchbase-server-community_7.6.0-linux_amd64.deb
# Install the package
sudo dpkg -i couchbase-server-community_7.6.0-linux_amd64.deb
# Fix any dependency issues
sudo apt --fix-broken install -y💡 Tip: For Enterprise Edition, replace 'community' with 'enterprise' in the download URL. Enterprise Edition requires a valid license.
# Check service status
sudo systemctl status couchbase-server
# Enable Couchbase to start on boot
sudo systemctl enable couchbase-server
# Start if not running
sudo systemctl start couchbase-serverInitial Configuration
Web Console Setup
Access the Couchbase Web Console at:
http://YOUR_SERVER_IP:8091Click 'Setup New Cluster' and configure:
- Cluster Name: A descriptive name (e.g., 'ramnode-production')
- Admin Username: Strong username (avoid 'admin')
- Admin Password: Complex password with 12+ characters
Service Memory Allocation (8 GB VPS)
| Service | Memory | Purpose |
|---|---|---|
| Data Service | 4096 MB | Document storage and retrieval |
| Index Service | 1024 MB | Secondary index management |
| Search Service | 512 MB | Full-text search operations |
| Query Service | 512 MB | N1QL query execution |
| Analytics | 512 MB | Real-time analytics |
| OS/System | ~1200 MB | Reserved for system |
Command-Line Configuration
For automation, use the CLI to initialize the cluster:
/opt/couchbase/bin/couchbase-cli cluster-init \
--cluster localhost \
--cluster-username admin \
--cluster-password YOUR_SECURE_PASSWORD \
--cluster-name ramnode-cluster \
--cluster-ramsize 4096 \
--cluster-index-ramsize 1024 \
--cluster-fts-ramsize 512 \
--cluster-eventing-ramsize 256 \
--cluster-analytics-ramsize 512 \
--services data,index,query,search/opt/couchbase/bin/couchbase-cli bucket-create \
--cluster localhost \
--username admin \
--password YOUR_SECURE_PASSWORD \
--bucket myapp \
--bucket-type couchbase \
--bucket-ramsize 1024 \
--bucket-replica 1 \
--enable-flush 0/opt/couchbase/bin/couchbase-cli user-manage \
--cluster localhost \
--username admin \
--password YOUR_SECURE_PASSWORD \
--set \
--rbac-username appuser \
--rbac-password APP_USER_PASSWORD \
--rbac-name "Application User" \
--roles bucket_full_access[myapp] \
--auth-domain localSecurity Hardening
Firewall Configuration
# Enable UFW if not already enabled
sudo ufw enable
# Allow SSH
sudo ufw allow 22/tcp
# Allow Couchbase Web Console (restrict to your IP)
sudo ufw allow from YOUR_IP_ADDRESS to any port 8091
# Allow Couchbase services from application servers
sudo ufw allow from APP_SERVER_IP to any port 11210
sudo ufw allow from APP_SERVER_IP to any port 8093
# For cluster nodes (internal network only)
sudo ufw allow from 10.0.0.0/8 to any port 8091:8096
sudo ufw allow from 10.0.0.0/8 to any port 11210
# Verify rules
sudo ufw status verboseEnable TLS/SSL
# Generate self-signed certificate (for testing)
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout /opt/couchbase/var/lib/couchbase/inbox/pkey.key \
-out /opt/couchbase/var/lib/couchbase/inbox/chain.pem \
-subj "/CN=couchbase.yourdomain.com"
# Set proper permissions
sudo chown couchbase:couchbase /opt/couchbase/var/lib/couchbase/inbox/*
sudo chmod 600 /opt/couchbase/var/lib/couchbase/inbox/pkey.key
# Reload certificates
/opt/couchbase/bin/couchbase-cli ssl-manage \
--cluster localhost \
--username admin \
--password YOUR_SECURE_PASSWORD \
--reload-cert /opt/couchbase/var/lib/couchbase/inbox💡 Production Tip: Use certificates from a trusted Certificate Authority. Let's Encrypt certificates work well with Couchbase.
Enable Audit Logging
/opt/couchbase/bin/couchbase-cli setting-audit \
--cluster localhost \
--username admin \
--password YOUR_SECURE_PASSWORD \
--set \
--audit-enabled 1 \
--audit-log-path /opt/couchbase/var/lib/couchbase/logs \
--audit-log-rotate-interval 86400Multi-Node Cluster Setup
For high availability and increased performance, deploy Couchbase across multiple VPS nodes.
# From the primary node, add a new server
/opt/couchbase/bin/couchbase-cli server-add \
--cluster localhost \
--username admin \
--password YOUR_SECURE_PASSWORD \
--server-add NODE2_IP:8091 \
--server-add-username admin \
--server-add-password YOUR_SECURE_PASSWORD \
--services data,index,query/opt/couchbase/bin/couchbase-cli rebalance \
--cluster localhost \
--username admin \
--password YOUR_SECURE_PASSWORDNode Placement Strategy
| Node | Services | RAM Allocation |
|---|---|---|
| Node 1 (Primary) | Data, Query | Data: 6GB, Query: 1GB |
| Node 2 | Data, Index | Data: 5GB, Index: 2GB |
| Node 3 | Data, Search, Analytics | Data: 4GB, Search: 1GB, Analytics: 2GB |
Backup and Recovery
# Create backup repository
/opt/couchbase/bin/cbbackupmgr config \
--archive /backup/couchbase \
--repo couchbase-backup
# Perform a full backup
/opt/couchbase/bin/cbbackupmgr backup \
--archive /backup/couchbase \
--repo couchbase-backup \
--cluster couchbase://localhost \
--username admin \
--password YOUR_SECURE_PASSWORDAutomated Backup Script
#!/bin/bash
BACKUP_DIR="/backup/couchbase"
REPO_NAME="daily-backup"
CB_HOST="localhost"
CB_USER="admin"
CB_PASS="YOUR_SECURE_PASSWORD"
DATE=$(date +%Y%m%d_%H%M%S)
LOG_FILE="/var/log/couchbase-backup.log"
echo "[$DATE] Starting backup..." >> $LOG_FILE
/opt/couchbase/bin/cbbackupmgr backup \
--archive $BACKUP_DIR \
--repo $REPO_NAME \
--cluster couchbase://$CB_HOST \
--username $CB_USER \
--password $CB_PASS >> $LOG_FILE 2>&1
if [ $? -eq 0 ]; then
echo "[$DATE] Backup completed successfully" >> $LOG_FILE
else
echo "[$DATE] Backup failed!" >> $LOG_FILE
fi
# Remove backups older than 7 days
find $BACKUP_DIR -type d -mtime +7 -exec rm -rf {} \; 2>/dev/nullsudo crontab -e
# Add this line:
0 2 * * * /opt/scripts/couchbase-backup.sh/opt/couchbase/bin/cbbackupmgr restore \
--archive /backup/couchbase \
--repo couchbase-backup \
--cluster couchbase://localhost \
--username admin \
--password YOUR_SECURE_PASSWORD \
--start oldest \
--end latestMonitoring and Maintenance
Key Metrics to Monitor
- Operations per second (ops/sec)
- RAM and disk usage percentage
- Cache miss ratio
- Replication queue length
- Query service response times
Prometheus Integration
# Couchbase exposes Prometheus metrics at:
# http://localhost:8091/_prometheus
scrape_configs:
- job_name: 'couchbase'
static_configs:
- targets: ['localhost:8091']
basic_auth:
username: admin
password: YOUR_SECURE_PASSWORD
metrics_path: /_prometheusLog Files
Located at /opt/couchbase/var/lib/couchbase/logs/
| Log File | Description |
|---|---|
| couchbase.log | Main server log |
| error.log | Error messages |
| audit.log | Security audit events |
| query.log | N1QL query service logs |
/opt/couchbase/bin/couchbase-cli setting-log \
--cluster localhost \
--username admin \
--password YOUR_SECURE_PASSWORD \
--log-rotation-size 50 \
--log-rotation-period 7Troubleshooting
Service Won't Start
# Check service status
sudo systemctl status couchbase-server
# View logs
sudo journalctl -u couchbase-server -n 100
# Verify available memory
free -hHigh Memory Usage
/opt/couchbase/bin/couchbase-cli setting-cluster \
--cluster localhost \
--username admin \
--password YOUR_SECURE_PASSWORD \
--cluster-ramsize 3072Cluster Node Unreachable
# Test connectivity
nc -zv NODE_IP 8091
nc -zv NODE_IP 11210
# Check cluster status
/opt/couchbase/bin/couchbase-cli server-list \
--cluster localhost \
--username admin \
--password YOUR_SECURE_PASSWORDUseful Commands Reference
| Command | Purpose |
|---|---|
| couchbase-cli cluster-info | Display cluster information |
| couchbase-cli server-list | List all cluster nodes |
| couchbase-cli bucket-list | List all buckets |
| couchbase-cli failover | Failover a node |
| couchbase-cli recovery | Recover a failed node |
| couchbase-cli rebalance | Rebalance cluster data |
Deployment Complete!
You've successfully deployed Couchbase Server on your RamNode VPS. This setup provides a solid foundation for building high-performance applications with flexible JSON data modeling and powerful N1QL querying.
