Building demos, experimenting with prototypes, daily builds, bug verifications, whitebox, blackbox, fuzz, performance, scale and stress testing… I create and destroy quite a few Couchbase Server clusters every day. My go-to cloud these days is Azure, for these experimentations. For Azure fans, shared the github project I use on my OS-X El-Capitan. It is in our general couchbaselabs repo: https://github.com/couchbaselabs/couchbase-azure

There are only a few scripts to get this all done.

  • Prerequisites 
    • install_prereqs.sh – simpler script to get you set up on OSx with node and azure-cli. Obviously, Run this once before you start using the rest of the scripts. You may see a few warnings during install. to make sure all worked well, I do an “azure login” at the end. it is supposed to ask you to log in a browser with a message like the following: “info:    To sign in, use a web browser to open the page https://aka.ms/devicelogin. Enter the code ——– to authenticate.” and will wait for you to sign in to your azure account.

  • Settings
    • settings.sh – settings file to populate your azure account info, subscription id and couchbase server settings. There are 2 azure settings you need to supply before you can run automated scripts. You can search settings file for TODO to identify the variables. Here is what you need to populate into settings at a minimum.
      • Azure Settings:
        • Provide your azure account and subscription ID: You can use “azure login -u followed by “azure account show” to get the subscription id.
        • Generate your certs: Certs are used for passwordless connectivity. This is required for the automation to work. Use “ssh-keyget” to generate the certs.
      • Couchbase Settings:
        • I also recommend you change your azure admin account name and password (used for logging into the web console at http://IP:8091) and the jumpbox admin account and passwords (used for connecting to the windows server jumpbox).

Figure: highlighted the TODO: items recommended above

  • Create and Delete Couchbase Server Cluster
    • create_azure_cluster.sh – this is the automated script that will provision VMs, download and install Couchbase Server and construct your cluster.  You will need to login to your azure subscription first. The script has 3 parts. Configuring a vnet, jumpbox and couchbase server cluster. 
      • VNet Config (virtual network): Allows all nodes to communicate over 10.0.* addresses. This is done for network efficiency.
      • Jumpbox Config: Jumpbox is needed so Couchbase Server cluster is not exposed to the internet. Jumpbox reside in the same vnet as the cluster and can get to the cluster through private IPs for administration. By default it is a windows server node. The RDP address and port is echoed to the console at the end of the setup. You can specify a different image or disable to jumpbox altogether using the disable_jumpbox setting.
      • Cluster Config: For each node of the cluster, the script create a VM in the vnet, downloads and installs the Couchbase Server image specified and forms a cluster using the nodes. After each download+install, the script will run CLUSTER-INIT for the first node, ADD for subsequent nodes and REBALANCE with the last node. The script will echo the web console link and vm and cluster admin account information.

The output will look something like this.

  • delete_azure_cluster.sh – this is the mopup script! cleans up and deploys the cluster, jumpbox and the vnet. It will use the vm_name_prefix to find and delete the nodes so it is important you pick a unique prefix for VM names. It will confirm deletion with each node with a [y/n]. If you'd like a fast and silent delete (after experimenting with the script a few times for safety), you can turn the fast_delete mode in the setting file.

The output will look something like this.

 

Remember, you can find the full set of scripts here in github: https://github.com/couchbaselabs/couchbase-azure.

Happy hacking!

-cihan

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.

Leave a reply