Thank you for contacting us. We will get back to you shortly.
June 03, 2015 - by Casey Bisson
The Couchbase-in-Docker image used in this post has been updated to use ContainerPilot and run with even more automation. Please find the latest information about running Couchbase in Docker in the Github repo: github.com/autopilotpattern/couchbase and see it in context in our blueprint on monitoring and scaling applications with ContainerPilot telemetry.
Couchbase, Docker, and Joyent's Elastic Container Service make deploying and scaling Couchbase clusters fast and easy. Triton's bare metal containers offer the elasticity and performance to meet the needs of the most demanding applications. These benefits are available for traditional deployments in infrastructure containers, but deployments in Docker containers enjoy an even greater level of built-in automation.
Couchbase's built-in cluster awareness and automatic management of data, including sharding and cross-datacenter replication make it ideal for deployment in Docker containers on Triton, while Triton's container-native infrastructure solves the network, performance, and security problems that have hampered many Dockerization efforts.
docker run.... There's no special software to install or configure whether you're deploying one container or a hundred thousand.
If you don't already have a Joyent account, go get one now. With that and an SSH key loaded, get your environment setup with
curl -O https://raw.githubusercontent.com/joyent/sdc-docker/master/tools/sdc-docker-setup.sh && chmod +x sdc-docker-setup.sh ./sdc-docker-setup.sh -k us-east-3b.api.joyent.com
Once your environment is all setup
cdinto the cloned or downloaded directory.
bash start.bashto start everything up.
bash start.bashto see the working, one-node cluster.
docker-compose --project-name=ccic scale up couchbase=$nand watch the node(s) join the cluster in the Couchbase dashboard.
Really, that's all it takes to launch a multi-node Couchbase cluster. Need more nodes? Just
docker-compose --project-name=ccic scale up couchbase=100, or even higher. Try it out for yourself or watch the screencast to see how easy it is, then take a look at the detailed steps below to see how you can do it with your own apps.
Okay, let's take a look at how this works. The
start.bash script automatically does the following:
docker-compose pull docker-compose --timeout=120 --project-name=ccic up -d --no-recreate
Those Docker Compose commands read the docker-compose.yml, which describes the three services in the app. The second command, we can call it
docker-compose up for short, provisions a single container for each of the services.
The three services include:
Once the first set of containers is running, the
start.bash script bootstraps the Couchbase container with the following command:
docker exec -it ccic_couchbase_1 triton-bootstrap bootstrap benchmark
Look in the repo or at the bootstrap script itself for full details of what that command does, but the short story is that it initializes the cluster and creates a bucket, then registers this one node Couchbase service with the Consul container.
Because one Couchbase container can get lonely, it's best to scale it using the following command:
docker-compose --timeout=120 --project-name=ccic scale couchbase=$COUNT
Docker Compose will create new Couchbase containers according to the definition in the docker-compose.yml, and when those containers come online they'll check with Consul to see if there's an established cluster. When they find there is, they'll join that cluster and rebalance the data across the new nodes.