Couchbase Server

Couchbase Cluster using Docker

Docker Swarm and Service Mode to create Couchbase Cluster explained how to create a Couchbase Cluster using Docker. It used the concept of a “master” and a “worker” service to simplify and automate the creation of cluster. The homogenous cluster was then created as shown in the architecture diagram below:
docker-service-couchbase-cluster
Complete details and background are in the Couchbase Cluster using Docker blog.

Docker 1.13 was released last week. A new feature in that release allows to deploy multi-container application defined using Docker Compose to multi-host enabled using Swarm mode. Ideally, we’d like to have a single Docker Compose definition that allows to start “master” service and start/scale “worker” service. But the “master” service, more importantly the container within the service, needs to be fully up before the “worker” service can be started. This is because the containers in the “worker” service register with the container in the “master” service to create the cluster. This typically require a bit of handcrafting as defined at Controlling Startup Order in Compose. So we’ll come back to that version later.

This blog will provide a quick refresh of the steps from the original using Docker 1.13. Read this blog for a quick how and the original blog for more details on why.

Create network:

Check the created network using docker network ls command:

Create Couchbase “master” service:

Check the created service using docker service ls command:

Create Couchbase “worker” service:

Check the created service again using docker service ls command:

Check the worker service logs using newly introduced command docker service logs couchbase-worker command. This command, newly introduced in Docker 1.13, pulls logs from all containers in the service and streams them to your console. There is no need to track down which containers are running on which hosts.

Complete logs show how the “worker” service was created and joined the cluster originally created by “master”.

Scale the cluster by scaling the Docker service:

Check the service again using docker service ls command:

Now you’ve a three node Couchbase cluster. Before rebalancing the cluster, let’s quickly check what does Console da Web do Couchbase shows.

Couchbase Web Console is accessible at https://localhost:8091 and shows a single Couchbase node with data, index and query service. This node was created using “master” service. Two additional nodes created using “worker” service are shown in Pending Rebalance tab:
docker-couchbase-cluster-1.13-three-nodes
Click on Rebalance to rebalancear the cluster and see the fully rebalanced cluster:
docker-couchbase-cluster-1.13-rebalanced

Want to get started with Couchbase? Look at Couchbase Starter Kits.

Want to learn more about running Couchbase in containers?

Compartilhe este artigo

Autor

Arun Gupta é o vice-presidente de defesa de desenvolvedores (developer advocacy) na Couchbase. Ele construiu e liderou comunidades de desenvolvedores por mais de 10 anos na Sun, Oracle e Red Hat. Ele possui vasta experiência na liderança de equipes multifuncionais para desenvolver e executar estratégias, planejamento e execução de conteúdos, campanhas de marketing e programas. Antes disso, ele liderou equipes de engenharia na Sun e é um membro fundador da equipe do Java EE. Gupta é autor de mais de 2.000 posts em blogs sobre tecnologia. Ele tem ampla experiência em palestras em mais de 40 países sobre uma miríade de tópicos e é um JavaOne Rock Star por três anos consecutivos. Gupta também fundou o capítulo do Devoxx4Kids nos EUA e continua a promover a educação tecnológica entre crianças. Autor de vários livros sobre tecnologia, um corredor ávido, um viajante do mundo, um Java Champion, líder de JUG, membro do NetBeans Dream Team e um Docker Captain, ele é facilmente acessível em @arungupta.

Uma resposta

  1. […] may also consider running Couchbase Cluster using Docker or read more about Deploying Docker Services to […]

Deixe um comentário

Pronto para começar com o Couchbase Capella?

Começar a construir

Confira nosso portal para desenvolvedores para explorar o NoSQL, navegar por recursos e começar com tutoriais.

Use o Capella free

Coloque a mão na massa com o Couchbase em apenas alguns cliques. O Capella DBaaS é a maneira mais fácil e rápida de começar.

Entre em contato

Quer saber mais sobre as ofertas do Couchbase? Deixe-nos ajudar.