Greetings Everyone,

I am a new recruit but a long time fan of Couchbase. First a quick intro:

Name is Cihan Biyikoglu and I am product management at Couchbase. I worked on a number of database platforms in past life and Couchbase Server #4! In previous lives, I worked on SQL Azure & SQL Server, Informix and Illustra. In the last decade, I also 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 Azure virtual machines. It is a step by step guide to get your environment running on Azure.

By the way, If you are looking to automate the deployment of a Couchbase Cluster on Azure, there is a new post and scripts on github porject here.

Automated Deployment for Couchbase on Azure

https://github.com/couchbaselabs/couchbase-azure

Fast and Easy Single Node Configuration with Couchbase Server on Azure

It is pretty simple to get a single node Couchbase Server up and running. In fact you can avoid all this and simply use the Azure Marketplace Images for Couchbase Server. If you rather build you own simple single node deployment, here are the steps:

  1. Create a VM: I’ll use Windows Server for the example. You can see the full instructions here.
  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 Azure

If you are planning a more robust production grade deployment with Couchbase Server, read on…

For a multi-node deployment on Azure, there are a few more optimizations you need to do. 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 (meaning customers in europ can hit the European data centers in Azure vs customer in US can hit US based data centers for their data access). Thus many customers, in production, set up 2 or more Couchbase Server clusters that is replicating data with Cross DataCenter Replication (XDCR).

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: Iterate as many as nodes you like to be in the cluster.
  4. Configure Couchbase cluster: Simple steps to form the 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.
  1. Get the image ready for capture: at the command-line run “%windir%system32sysprepsysprep.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 you captured in step #2.
    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 Mount new disks to get storage capacity:

OS drives come with 30GB capacity and you’ll be stuck soon out of storage capacity if you don’t mount additional drives. Various VM sizes allow for various number of drives to be mounted. You can also configure multiple drives into a RAID configuration easly. Here are the steps to get there.

#5 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
    1. Remember to use private IPs (10.0.0.x addresses) here
    2. Remember also to use the mounted drives from step #4 with more storage capacity when choosing the storage location for data and index storage with Couchbase.
  2. Click on “Servers Nodes” on the Couchbase Web Console and click “Add Server” to add the remaining nodes (use private IPs – 10.0.0.x here as well
  3. When you are done adding all node, click “Rebalance” to complete node configuration.

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

#6 Optionally, Configure Cross Datacenter Replication for Multi Region Deployments:

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.

Security Note: It is also important to secure the endpoints and Azure provides help here. You can use these with Couchbase Server as well to limit communication from your app to Couchbase or between Couchbase clusters with XDCR.

Ok, This was a quick around-the-block tour of how to set up Couchbase on Windows Azure. Looking forward to all the feedback.

-cihan biyikoglu

Author

Posted by Cihan Biyikoglu, Director of Product Management, Couchbase

Cihan Biyikoglu is a director of product management at Couchbase, responsible for the Couchbase Server product. Cihan is a big data enthusiast who brings over twenty years of experience to Redis Labs’ product team. Cihan started his career as a C/C++ developer.

5 Comments

  1. Neil Mackenzie March 8, 2014 at 12:12 am

    Cihan – Thanks for showing us another NoSQL option for Windows Azure.

    It is now possible to specify the static IP address for an instance, which may simplify the node/IP allocation in the hosts file.

    http://windowsitpro.com/window

    When you create a second cluster in another region you can access it only through the public IP address. You may want to ACL the Couchbase endpoints so that the two clusters can communicate, but no one else can get in.

    http://msdn.microsoft.com/en-u

    1. Cihan Biyikoglu March 11, 2014 at 11:09 pm

      Great tips Neil. Thanks!

      Edited a few corners to reflect these.

  2. armando restrepo April 30, 2015 at 8:01 pm

    Is there a way to setup couchbase cluster on vm\’s but access them from azure app services instead of having vm\’s for application servers?

  3. […] Step by Step: Production Deployment with Couchbase on Windows Azure Virtual Machines […]

Leave a reply