Getting started with Crate on Microsoft Azure

Microsoft Azure is the second largest and fastest growing provider of Cloud Services in the world. It offers a wide variety of options including Windows servers, containers, application images and much more.

Getting Crate working on Azure with Linux or Windows is a simple process. You can use Azure's management console or CLI interface (Learn how to install here).

Azure & Linux

Create a Resource Group

Azure uses 'Resource Groups' to group together related services and resources for easier management.

Create a resource group for the Crate cluster by selecting Resource groups under the new left hand panel of the Azure portal.

Create Virtual Network

Create a Network Security Group

Crate uses two ports, one for inter-node communication (4300) and one for it's http endpoint (4200), so access to these needs to be opened.

Create a New Security Group, giving it a name and assigning it to the 'Resource Group' just created.

Create New Security Group

Find that security group in your resources list and open it's settings, navigating to the Inbound security rules section.

Create New Security Group

Add a rule for each port:

Create New Security Group

Create a Virtual Network

To create a cluster of Crate nodes on some cloud hosting providers, Crate relies on unicast for inter-node communication.

The easiest way to get Unicast communication working with Azure is to create a Virtual Network (+ -> Networking -> Virtual Network) so that all the cluster nodes exist on the same IP range. Give the network a name, a region and let Azure handle all the remaining settings by clicking the next arrow on each screen.

Create Virtual Network

Once the Virtual Network has been created, find it in your resources list, open the edit screen and the Subnets setting. Add the security group created earlier to the subnet.

Add Security Group

Create Virtual Machines

Next create virtual machines to act as your Crate nodes. In this tutorial, I chose two low-specification Ubuntu 14.04 servers, but you likely have your own preferred configurations.

Most importantly, make sure you select the Virtual Network created earlier.

Install Crate

Note that these instructions should be followed on each VM in your cluster.

To Install Crate, ssh into your VMs and follow the standard process for Linux installation, this will automatically start an instance of Crate, which we will need to restart after the next step.

Configure Crate

Note that these instructions should be followed on each VM in your cluster.

To set the Unicast hosts for the Crate cluster we change the default configuration file at /etc/crate/crate.yml.

Uncomment / add these lines:

discovery.zen.ping.unicast.hosts:
      - internal-ip-address:4300
      - internal-ip-address:4300

Note You might want to try DNS based discovery for inter-node communication, find more details in our documentation.

Uncomment and set the cluster name

cluster.name: crate

Restart Crate service crate restart.

Azure & Windows

Initial Setup

To create a Resource Group, Network security group and virtual network, follow the same steps as for Azure and Linux.

Create Virtual Machines

Similar steps to creating Virtual Machines for Azure and Linux, but create the VM based on the 'Windows Server 2012 R2 Datacenter' image.

Install Crate

Note that these instructions should be followed on each VM in your cluster.

To install Crate on Windows Server, you will need a Java JDK installed. Ensure that the JAVA*HOME environment variable is set.

Environment Variables

Next download the Crate Tarball, expand it and move to a convenient location.

Configure Crate and Windows

Note that these instructions need to be followed on each VM in your cluster.

Edit the config/crate.yml configuration file in the expanded directory to make the same changes noted above in running Crate on Azure & Linux.

We need to allow the ports Crate uses through the Windows Firewall

Firewall configuration

Start crate by running bin/crate.

Next Steps