Thursday, 25 June 2015

Using the Rexter 2.7 Graph Server with Couchbase Server

One of my side projects at Couchbase is a Graph-API on top of it. This article explains how you can use the Rexter Graph Server with this implementation of the Blueprints 2.x API.

There is a forked version of Rexter available here: .

However, the modifications are quite simple.

I disabled the enforcer plug-in in the main pom.xml file.

The 'rexter-server/pom.xml' file contains additional dependencies.


Also the file 'rexter-server/config/rexter.xml' was edited in order to use the Couchbase instance.


To have this working it is expected that you have previously built CBGraph and that it sits in your local Maven cache. It can be found here:

Your Couchbase connection is currently configured via the file '' which is part of the source code of CBGraph.

## Connection to Couchbase

## Views on side of Couchbase

So the steps are:

  • Run 'mvn install' in the CBGraph project
  • Run 'mvn install' in the Rexter project

Rexter's target folder now should contain a folder which is called 'rexster-server-2.7.0-SNAPSHOT-standalone'.
  • Execute 'bin/ -s'
You should see a message like

[INFO] Slf4JLogger - Connected to Node
[INFO] Slf4JLogger - Opened bucket graph
[INFO] Slf4JLogger - Connected to Node
[INFO] Slf4JLogger - Connected to Node

Now let's play a bit with the Rexter REST interface:
You can also browse the Graph via Rexter's UI:  http://localhost:8182/doghouse 

Here an example screen shot:

Tuesday, 9 June 2015

Using Couchbase Server with Docker

There was a very good talk at Couchbase Connect about Docker some days ago (Deploying Couchbase Server Using Docker: Couchbase Connect 2015). So I just played a bit around with it and want to share my impressions.

I am running Docker on MacOS which means that 'boot2docker' is required. Because Docker is using Linux kernel features,  a Linux-VM with a Docker daemon is running in the background. So this VM is used to host our containers.

  • Install 'boot2docker'
  • Start it by using the application menu, which opens you a shell which has all required environment variables set (boot2docker init --> boot2docker start --> boot2docker shellinit)
Couchbase has now a fully supported Docker image. So the installation of a node is quite simple:

  • docker run -d -P --name couchbase-1 couchbase
This starts a container in a daemon mode with the id 'couchbase-1' by using the Couchbase image. Ports are exposed/mapped to the outside.

In order to double check which containers are running use the following command:

docker ps

To see the port mappings, the following command can be used

docker port couchbase-1

This gives me the following output for my first Couchbase node:

11207/tcp ->
11210/tcp ->
11211/tcp ->
18091/tcp ->
18092/tcp ->
8091/tcp ->
8092/tcp ->

The Docker host VM is accessible via the following command which returns in my case.

boot2docker ip

So we can access the Admin-UI of our node by using (instead of using port 8091).

The internal IP can be determined by using Docker's exec command:

docker exec -it couchbase-1 ifconfig

So far so good. But how to build a cluster?

  • Setup Couchbase within the container 'couchbase-1' via the Admin-UI by creating a new cluster. I used the internal IP address as the name. Productive environments should care about the name resolution.
  • Just run a second Couchbase container and name it 'couchbase-2'
  • Retrieve the port mapping for 'couchbase-2' and access the Admin-UI via the port which is mapped to 8091.
  • Join the existing cluster by pointing to the internal IP of the container which was called 'couchbase-1'. The default ports are accessible internally (between containers).
  • Repeat the steps for a third node 'couchbase-3'
Additional containers could host applications. By default my containers could reach each other via the internal IP addresses. I think it will be more challenging to access the Cluster from the outside even if the ports are mapped, but the idea here is anyway to deploy especially your applications via Docker. Access from the outside would need to configure the used Couchbase client library specifically regarding these port mappings. Also, here some further details about Docker's networking: .

!Important! The Docker trend causes that containers are used within VM-s (those are deployed via IaaS cloud systems like Amazon EC2). I even saw it in a VMWare environment whereby the intention was to use the VM-s more efficiently and to unify the application deployment process. So what you see there are multiple containers per VM. Unlike Application Servers, Couchbase is designed to use dedicated resources, so for instance a specific per node RAM quota. The cluster is sized in a way that it fits your requirements, so it's not expected to have a real waste of resources in this case. Especially for performance critical use cases it would NOT follow Couchbase's best practices to run Couchbase Server in a container (Docker) which is again running in a container (VM).
  • Docker in general is useful for setting up Test and Development environments (even for containers those are hosted in VM-s)
  • As soon as your use case is more performance critical then my opinion is that you should use Docker at least on bare-metal for your productively used Couchbase Server deployments
This is especially underlined by the documentation of the Docker image: . There you can see that the only productively recommended deployment is the one which is named 'Multiple hosts, single container on each host'.

Feedback is highly appreciated! :-)