A Couchbase for Any CloudPosted By: Uri Cohen on January 17, 2013
Couchbase is a great NoSQL database. It combines the power and flexibility of a schemaless document store, in-memory performance and super simple clustering and administration.
So it’s not surprising that a good 50% of Couchbase users have chosen to use it on the cloud.
For the average Couchbase user (yours truly included, no special Couchbase ninja skills here), deploying and managing a Couchbase-driven application on the cloud can seem like a daunting task. There are many options out there, each with their own benefits and considerations. You can always roll out your own deployment, or use tools like Chef, Puppet, CloudFormation or even RightScale. Comparing them all is a blog post unto itself, and this post is lengthy enough as is… So in this post I’m going to focus on how Cloudify allows you to deploy, manage and scale your Couchbase app on any cloud environment.
But first thing’s first, let’s take a deeper look at what it takes to manage multi-tier apps on the cloud:
- Starting VMs: A no brainer. Running your app requires compute resources. ’Nuff said.
- Installing and configuring the started VMs: Every VM needs proper installation and configuration. For example, for VMs which Couchbase runs on, you need to install Couchbase and configure the VM and installation to your liking (mount external volumes if needed, configure networking, ports, etc.).
- Starting and orchestrating application components: A truth I hold to be self-evident – all application tiers have inter-dependencies, and as a result they have to be aware of one another. For example, before starting your web container, you will need to make sure that your Couchbase cluster has successfully started and can be connected to, and you will need to expose the IP addresses and ports of that cluster to the web server.
- Repairing: Another truth – and this one is Murphy’s not my own. What can go wrong, will go wrong. So it’s best to prepare for the worst. Once everything is up and running, things inevitably will break. Processes will die for no apparent reason, VMs will come and go, and you need your application to continue to work even when this happens.
- Monitoring key metrics and scaling your application tiers based on them: Let’s assume that this is for the best of reasons, not the worst, where your load spikes due to your application or service being inordinately successful. You need to be able to identify the load on your app across its various tiers and for very specific metrics (e.g. request latency), and take action based on it to make sure your users keep getting a decent service level. For example, if you see that the CPU load in your Couchbase server goes above 70%, you will want to add another instance and rebalance the cluster to even the load.
- Updating your application code: last, and not less important, is the update cycle of your application. In many cases you can’t afford downtime, so having a mechanism that allows you to push code to the running instances on the fly is essential (naturally there’s much more to continuous delivery than pushing code, but this too is a topic for a separate post).
In a cloud environment, which is dynamic and volatile by nature, it’s also extremely important to automate all of these processes, so that you can set up environments easily and consistently, switch between environments, test things before you go live, maximize your utilization and minimize downtimes.
How Cloudify Enters the Mix
Things we know about Cloudify already – it’s an open source framework for deploying, managing and scaling your applications on any cloud environment. It’s designed to handle all of the above for you, while enabling you to retain a high degree of control and flexibility by defining things from an application perspective rather than an infrastructure perspective, through our built-in recipes. So that brings me to the essence of the post…
We have just added an awesome Couchbase Recipe to our repo. This allows you to deploy your Couchbase-driven apps right out of the box. The recipe supports Couchbase 2.0, and auto-registers all cluster members when starting. It also supports dynamically adding instances with a single command, and takes care of all of the cluster joining and rebalancing for you! It will soon also support XDCR so you can replicate data between availability zones or even other clouds.
Here’s a snippet from the new Couchbase recipe:
[WARNING: SERIOUS GEEK STUFF AHEAD].
Ok, Now What?
Now, all you have to do is the regular Cloudify drill. Here’s a quick recap…
First, bootstrap a Cloudify controller environment on the cloud of your choice from the Cloudify CLI. From that point onwards, the CLI will communicate with the controller over REST. Next, you issue an install-application command that will trigger the controller to analyze the installed recipe, provision the right amount of VMs for it, and orchestrate the deployment of all the recipe components. This controller will then provide the cloud monitoring for the deployed components and VMs, scale them if needed (manually or using using cloud scaling rules) and make sure to restart any failed components.
Below is what this looks like in action (Click the image below to see how it works).
Gimme, gimme, gimme
And now after all the previous hype and buildup, we present the Cloudify player.
We’ve created a special Cloudify player that lets you test drive you Couchbase recipe on demand, without having to download or install Cloudify at all. By just clicking on the Play button below, and then waiting a couple of seconds, you will have a running Couchbase instance on the cloud, for you to fiddle around with for 20 minutes. You can then look at the Couchbase console or the Cloudify console, and even write test code to interact with this server.
Under the hood, the widget communicates with a server infrastructure that creates a dedicated Cloudify manager just for you, and uses the new Couchbase recipe to install and start the Couchbase server.
So what are you waiting for, take a seat, and start playing.
Note: To login to the Couchbase console, use the following credentials:
Follow Uri on Twitter!blog comments powered by Disqus