Seven Story Rabbit Hole

Sometimes awesome things happen in deep rabbit holes. Or not.


Running a Couchbase Cluster on Google Compute Engine

The easiest way to run Couchbase cluster on Google Compute Engine is to run all of the nodes in Docker containers.

Create GCE instance and ssh in

Follow the instructions on Running Docker on Google Compute Engine.

At this point you should be ssh’d into your GCE instance

Increase max number of files limit

If you try to run Couchbase Server at this point, you will get this warning because the file ulimit is too low.

Here’s how to fix it:

  • Edit /etc/default/docker
  • Add a new line in the file with:
ulimit -n 262144
  • Restart the GCE instance in the GCE web admin by going to Compute Engine / VM Instances / and hitting the “Reboot” button.

Note: in theory it should be possible to just restart docker via sudo service docker restart, however this didn’t work for me when I tried it, so I ended up restarting the whole GCE instance

Start Couchbase Server

gce:~$ sudo docker run -d -name cb1 -p 8091:8091 -p 8092:8092 -p 11210:11210 -p 11211:11211 ncolomer/couchbase

Verify it’s running

Find the Docker instance IP address

On the GCE instance, run:

gce:~$ sudo docker inspect -format '{{ .NetworkSettings.IPAddress }}' cb1

This should return an ip address, eg

Set it as an environment variable so we can use it in later steps:

gce:~$ export CB1_IP=

Run couchbase-cli

To verify that couchbase server is running, use the couchbase-cli to ask for server info:

gce:~$ sudo docker run -rm ncolomer/couchbase couchbase-cli server-info -c ${CB1_IP} -u Administrator -p couchbase

If everything is working correctly, this should return a json response, eg:

  "availableStorage": {
    "hdd": [
        "path": "/",

Start a 3-node cluster

On the GCE instance, run the following commands:

gce:~$ sudo docker run -d -name cb2 ncolomer/couchbase couchbase-start ${CB1_IP}
gce:~$ sudo docker run -d -name cb3 ncolomer/couchbase couchbase-start ${CB1_IP}

The nodes cb2 and cb3 will automatically join the cluster via cb1. The cluster needs a rebalance to be fully operational. To do so, run the following command:

gce:~$ sudo docker run -rm ncolomer/couchbase couchbase-cli rebalance -c ${CB1_IP} -u Administrator -p couchbase

Connect to admin web UI

The easiest way to manage a Couchbase Server cluster is via the built-in Web Admin UI.

In order to access it, we will need to make some network changes.

Expose port 8091 via firewall rule for your machine

Go to or equivalent, and find your ip address. Eg,

On your workstation with the gcloud tool installed, run:

$ gcloud compute firewalls create cb-8091 --allow tcp:8091 --source-ranges

This will allow your machine, as well any other machine behind your internet router, to connect to the Couchbase Web UI running on GCE.

To increase security, you should use ipv6 and pass your workstation’s ipv6 hostname in the --source-ranges parameter.

Find out external ip address of instance

On your workstation with the gcloud tool installed, run:

$ gcloud compute instances list
name     status  zone          machineType internalIP   externalIP
couchbse RUNNING us-central1-a f1-micro

Your external ip is listed under the externalIP column, eg in this example.

Go to admin in web browser

Go to into your web browser (replacing w/ your external ip)

You should see a screen like this:


Login with the default credentials:

  • Username: Administrator
  • Password: couchbase

And you should see the Web Admin dashboard:


Increase default bucket size

The default bucket size is set to a very low number by default (128M in my case). To increase this:

  • In Web Admin UI, go to Data Buckets / Default / Edit
  • Change Per Node RAM Quota to 1024 MB
  • Hit “Save” button