Starting Azure instances

You may want to automate the launch of the instances using the Azure API, but in this section, we will review the steps to start an Azure instance manually using the Azure command line interface. Please, first install the Azure CLI and login to your account using az login. The following steps also assume that you have created the gurobi server image in a resource group called gurobi.

Step 1: Configure Security Group

First create a security group using the cli:

az network nsg create -g gurobi --name gurobi-nsg

As an optional step, you can open the SSH port if you need to login to the machine:

az network nsg rule create -g gurobi --nsg-name gurobi-nsg --name allowSSH --priority 100 \
    --protocol tcp  --destination-port-range 22

Then, depending on the ports you will want to use, define the appropriate rules. If you want to use the default HTTP on port 80, you can set this rule:

az network nsg rule create -g gurobi --nsg-name gurobi-nsg --name allowHTTP --priority 101 \
    --protocol tcp --destination-port-range 80

If you want to use HTTP on the custom port 61000, you can set this rule:

az network nsg rule create -g gurobi --nsg-name gurobi-nsg --name allowHTTP --priority 101 \
    --protocol tcp --destination-port-range 61000

If you have setup HTTPS, please use the following rule:

az network nsg rule create -g gurobi --nsg-name gurobi-nsg --name allowHTTPS --priority 101 \
    --protocol tcp --destination-port-range 443

Step 2: Configure Instance Details

Configuration properties are passed to the instance via Azure Custom Data provided in a file. In this file, each line should be formatted as KEY=VALUE, as it is done in the grb_rs.cnf file. When building the Image you may have set some default values in the grb_rs.cnf file and you only need to specify the properties that you need to override. The following table indicates the important properties that you may want to override. For the complete list of properties, please refer to the Remote Services Reference Manual or run the command grb_rs properties:

Key Description
HOSTNAME DNS name of the node that can be resolved from the other nodes inside the same Azure VPC and the clients running in Azure or on-premise. By default, grb_rs will set the HOSTNAME to the public DNS name of the instance. If you want to use another name, set this property. For example, this is useful if you defined a custom DNS name in Route53 mapped to an Elastic IP attached to this node
PORT Port to use for HTTP and HTTPS communication. Only this port needs to be open in your Azure security group to let other nodes and clients access the cluster. By default, HTTP will use the port 80 and HTTPS the port 443. If you wish to use a different port, set this property.
CLOUDKEY Cloud key for your cloud license. You can find this value under the Downloads > Licenses menu on the Gurobi website. You will need this value to activate the full capabilities of a Compute Server.
WORKER Indicates that you do not need the full capability of a Compute Server, and that you will use this node as a Distributed Worker. You do not need a CLOUDKEY in this case.
IDLESHUTDOWN The machine will shut down automatically after being idle for the given time in minutes. If this is omitted, the machine will not shut down automatically when inactive.
CLUSTER_TOKEN Private password that enables different nodes to join the same cluster. All nodes of a cluster must have the same token. It is recommended to generate a new token using the grb_rs token command.
PASSWORD Password for clients to access the cluster. It is recommended to change the value by copying the output of the 'grb_rs hash' command. The default value is the hash of 'pass'.
ADMINPASSWORD Password for clients to access restricted administrative job operations. It is recommended to change the value by copying the output of the 'grb_rs hash' command. The default value is the hash of 'admin'
CLUSTER_ADMINPASSWORD Password for clients to access restricted administrative cluster operations. It is recommended to change the value by copying the output of the 'grb_rs hash' command. The default value is the hash of 'cluster'.
JOBLIMIT Default value of the maximum number of jobs that can run concurrently when using Compute Server. If the job limit is changed using the 'grbcluster config' command, this value will be ignored.
JOIN Defines one or more nodes to join and form a cluster. This property must contain a comma separated list of other Azure instances DNS name to join.
JOIN_TIMEOUT defines how long this node will retry to join the cluster. As Azure machines may take time to start, it is recommended to set a longer timeout than the default.

Here is a typical example to start a compute server:

CLOUDKEY=d67dcf8a-72b6-11e5-840b-0779f0f8b08e
PASSWORD=myAccessPassword
ADMINPASSWORD=myAdminPassword
CLUSTER_ADMINPASSWORD=myClusterAdminPassword
CLUSTER_TOKEN=myToken
IDLESHUTDOWN=60

Here is an example to start a compute server on a custom port 61000:

CLOUDKEY=d67dcf8a-72b6-11e5-840b-0779f0f8b08e
PASSWORD=myAccessPassword
ADMINPASSWORD=myAdminPassword
CLUSTER_ADMINPASSWORD=myClusterAdminPassword
CLUSTER_TOKEN=myToken
IDLESHUTDOWN=60
PORT=61000

Once you have started an Azure instance, you can add more instances to form a cluster. Let's assume that the first Azure instance was started with a public IP 64-82-45-124, then you can start additional instances and set the JOIN property to this address. Note that all the passwords and the cluster token must be identical for the setup to be correct.

CLOUDKEY=d67dcf8a-72b6-11e5-840b-0779f0f8b08e
PASSWORD=myAccessPassword
ADMINPASSWORD=myAdminPassword
CLUSTER_ADMINPASSWORD=myClusterAdminPassword
CLUSTER_TOKEN=myToken
IDLESHUTDOWN=60
JOIN=64-82-45-124

Here is a typical example to add a distributed worker:

WORKER=true
PASSWORD=myAccessPassword
ADMINPASSWORD=myAdminPassword
CLUSTER_ADMINPASSWORD=myClusterAdminPassword
CLUSTER_TOKEN=myToken
IDLESHUTDOWN=60
JOIN=64-82-45-124

Step 3: Start the instance

You are now ready to start the machine with the following command. Please replace the image name with the one that you generated earlier:

az vm create -g gurobi -n compute1  --image gurobi-server9.0.3-1535730766 --size Standard_F16s_v2 \
    --authentication-type password --admin-username ubuntu --admin-password MyAdminPassword01\
    --custom-data data --nsg gurobi-nsg

Once the command complete successfully, the public IP address will be displayed in the json log.

Try Gurobi for Free

Choose the evaluation license that fits you best, and start working with our Expert Team for technical guidance and support.

Evaluation License
Get a free, full-featured license of the Gurobi Optimizer to experience the performance, support, benchmarking and tuning services we provide as part of our product offering.
Academic License
Gurobi supports the teaching and use of optimization within academic institutions. We offer free, full-featured copies of Gurobi for use in class, and for research.
Cloud Trial

Request free trial hours, so you can see how quickly and easily a model can be solved on the cloud.

Search