Step by Step: Production Deployment with Couchbase on Windows Azure Virtual Machines
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:
- Create a VM: I’ll use Windows Server for the example.
- Install Couchbase Server: Open the browser on the VM, download Couchbase Server and install it on the VM.
- To allow communication to the node, open these ports on Windows firewall on your node.
- 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:
- 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.
- Capture a VM image: This help avoid having to do 'step 2' above over and over again for each node.
- Create nodes using the VM image
- Configure Couchbase cluster
- 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.
- Provide a name for your virtual network : CB_VN_WESTUS, Specify a new affinity group name: CBWESTUS
- Skip providing DNS Server or Point To Site configuration option
- 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,
- Create a VM on Windows Azure – I’ll use Windows Server for the example here.
- Choose Windows Server – just latest greatest
- Name your virtual machine: couchbase01. Specify a VM size and admin username and password.
- 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)
- To allow communication to the node, open these ports on Windows firewall on your node.
- 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.
- 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 …
- Get the image ready for capture: at the command-line run "%windir%\system32\sysprep\sysprep.exe /shutdown /oobe /generalize"
- 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.
- Create a VM from the Image -
- Name your virtual machine: couchbase01. Specify a VM size and admin username and password.
- Choose Virtual Network: CB_VN_WESTUS
- Repeat step 1 to create more nodes.
#4 Configure Couchbase Cluster
With this step, we’ll initialize the cluster and tie the nodes together.
- Double-click on the Couchbase icon on your desktop and configure Couchbase Server (use fully qualified hostnames here as well –nodename.cloudapp.net)
- 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)
- 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;
- Set up a second cluster: simply pick another region in Azure and repeat steps 1-4 to create another cluster in the region.
- 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
Comments