NoSQL Zone is brought to you in partnership with:

Don Pinto is a Product Marketing Manager with experience in cloud and database technologies. Don is a DZone MVB and is not an employee of DZone and has posted 94 posts at DZone. You can read more from them at their website. View Full User Profile

Step by Step: Production Deployment with Couchbase on Windows Azure Virtual Machines

03.11.2014
| 3266 views |
  • submit to reddit

This article was originally written by Cihan Biyikoglu

Greetings Everyone, 

I am a new recruit but a long time fan of Couchbase and I like shipping software and blogging about it. First a quick intro: name is Cihan Biyikoglu and I am product management at Couchbase. Couchbase is the 4th database platform in my career. In previous lives, I worked on SQL Azure & SQL Server, Informix and Illustra. For the last decade, I spent a whole lot of time crafting SaaS, PaaS and IaaS solutions and platforms. Fittingly, I wanted to kick off the first post focusing on getting Couchbase deployed on Windows Azure virtual machines. It is a step by step guide to get your environment running on Azure. Enjoy...

Here are the steps to getting your Couchbase cluster going on Windows Azure: 

  1. Create a VM: I’ll use Windows Server for the example. 
  2. Install Couchbase Server: Open the browser on the VM, download Couchbase Server and install it on the VM. 
    1. To allow communication to the node, open these ports on Windows firewall on your node.
  3. Configure Couchbase: Double-click on the Couchbase icon on your desktop and configure Couchbase (use default options) 

You are done! You have a single node deployment and that is all you need to play with Couchbase Server...

Production Configuration with Couchbase Server on Windows Azure

If you are a little more serious with Couchbase and like to get a production deployment out, read on...For a production deployment you need to do a bit more: Create a Couchbase cluster with more nodes for higher availability and higher throughput. For mission critical apps it is also key to be resilient to regional failures or data center failures, or simply provide lower latencies to users spread around the world. Thus many customers, in production, set up a second Couchbase cluster that is replicating data with Cross DataCenter Replication (XDCR) to get higher availability and/or disaster recovery and/or lower latency for your users in different geographies. 

Lets take a look at how to set up a production grade environment with Couchbase Server on Windows Azure:

  1. Set up Virtual Network: the main function of this is to use private IPs for Couchbase intra cluster communication. Details below as to why this is beneficial.
  2. Capture a VM image: This help avoid having to do 'step 2' above over and over again for each node. 
  3. Create nodes using the VM image
  4. Configure Couchbase cluster
  5. Optionally, Configure XDCR and get geographic distribution, availability and disaster recovery for your production deployment.

Lets get to the details.

#1 Set up Virtual Network: 

There really isn’t anything specific to Couchbase here. Virtual networks give you private IPs you can control and it does give you a shorter path to communicate between Couchbase nodes. You can use public IP addresses to communicate among nodes, but that means your communication has to travel to the edge of the Azure data center. 

  1. Provide a name for your virtual network : CB_VN_WESTUS, Specify a new affinity group name: CBWESTUS
  2. Skip providing DNS Server or Point To Site configuration option
  3. Specify the following Subnet Settings

#2 Capture a VM Image:

Capturing VM Images is a simple shortcut to stamp every node for your Couchbase Server cluster with the Couchbase binaries and firewall configuration. To do this, 

  1. Create a VM on Windows Azure – I’ll use Windows Server for the example here.
    1. Choose Windows Server – just latest greatest
    2. Name your virtual machine: couchbase01. Specify a VM size and admin username and password. 
  2. Open the browser on the VM, download Couchbase Server and install it on the VM (Turn off “IE Enhanced Security Configuration” to prevent warning popups)
  3. To allow communication to the node, open these ports on Windows firewall on your node.
  4. Configure private IP name resolution – this step ensures nodes communicate with each other over the private IPs for network efficiency. One way to do this is to create a hosts file with node names and private IPs of all nodes.
    1. This is a little tricky: You do need to follow a node naming scheme and make sure you create your VMs strictly in order to guarantee node names matches the private IPs assigned to each node. Remember that the private IPs will start from 10.0.0.4 for your first node, 10.0.0.5 for the second node and so on… So the "%windir%/system32/drivers/etc/hosts" file will have the following entries:
10.0.0.4  couchbase01.cloudapp.net
10.0.0.5  couchbase02.cloudapp.net
10.0.0.6  couchbase03.cloudapp.net
…
  1. Get the image ready for capture: at the command-line run "%windir%\system32\sysprep\sysprep.exe /shutdown /oobe /generalize"
  2. Once the VM shuts down, use the Windows Azure Management Portal to Capture the image. (right next to delete at the bottom pane of the portal)

#3 Create nodes using the VM Image:

We’ll use the VM Image you created to create the nodes you will use for your couchbase deployment.

  1. Create a VM from the Image - 
    1. Name your virtual machine: couchbase01. Specify a VM size and admin username and password. 
    2. Choose Virtual Network: CB_VN_WESTUS
  2. Repeat step 1 to create more nodes.

#4 Configure Couchbase Cluster

With this step, we’ll initialize the cluster and tie the nodes together. 

  1. Double-click on the Couchbase icon on your desktop and configure Couchbase Server (use fully qualified hostnames here as well –nodename.cloudapp.net) 
  2. Click on "Servers Nodes" on the Couchbase Web Console and click “Add Server” to add the remaining nodes (use fully qualified hostnames here as well –nodename.cloudapp.net) 
  3. When you are done adding node, click “Rebalance” to complete node configuration.

At this point you are ready to create your bucket and start pumping your workload to it.

#5 Create XDCR:

For mission critical apps it is key to be resilient to regional failures or data center failures or simply provide lower latencies to users spread around the world. Thus many customers set up a second Couchbase cluster that is replicating data with Cross DataCenter Replication (XDCR) to get higher availability and/or disaster recovery and/or lower latency for your users in different geographies. XDCR support a whole bunch of topologies for flexible replication schemes and you can learn all about XDCR here. For setting up a simple uni-directional topology, here is what you need to do;

  1. Set up a second cluster: simply pick another region in Azure and repeat steps 1-4 to create another cluster in the region. 
  2. Create your bucket on the second cluster and on your primary cluster configure XDCR using the fully qualified node name for referencing the remote cluster.

Ok, here is the around-the-block tour of how to set up Couchbase on Windows Azure. Looking forward to all the feedback. 

-cihan biyikoglu

Published at DZone with permission of Don Pinto, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)