In the ASM version or Classic mode prior to Azure, users can achieve some degree of automatic scaling (auto scaling) with PAAs services such as the Azure Website,azure Cloud service, but with many limitations and drawbacks, For example, it can only be used on PAAs platforms, with extended periods, inability to support custom images, inability to support Linux, and so on, so is there a service on Azure that gives our enhanced PAAs the ability to expand automatically, At the same time allowing users to have the maximum control ability as with the IaaS virtual machine?
A new service, called the Virtual Machine Extensions collection (Virtual Machine sCale sETS), is introduced in Azure in the latest explorer (ARM) mode. Enables true automation scaling (auto scaling) capabilities, providing very good feature support for scenarios where large concurrency requires automatic scaling, such as:
- Fine-grained performance collection and processing (performance data can be collected every minute, with a minimum of 5 minutes to expand or contract as a processing window)
- Support for Linux and, of course, windows
- Supports custom mirroring for customers and does not need to be pre-deployed like previous cloud services
- Deploy hundreds of servers in minutes
- Services such as load balancers, high-availability collections, application gateways, etc. can be consolidated in an extended set
- Supports multiple different types of measures (Cpu/memeory/network/disk) for scaling
In this article, we describe how to create a Linux VMSS on the Azure China platform through arm templates and PowerShell to automate the expansion. For what is arm, what is arm template, arm and ASM comparison differences, etc. see my other blog.
- First make sure you have an account for Azure in China and are able to log in to the Azure portal in the preview version normally:
?
https://portal.azure.cn
?
- Install the latest Azure Powershell, currently the latest version is 2.0.1:http://aka.ms/webpi-azps
- Azure provides a lot of sample templates for users to use, users can easily download, modify and apply these templates, all templates are on GitHub, the specific address is as follows:
Https://github.com/Azure/azure-quickstart-templates
- All templates are JSON files, can be modified by themselves, found in the above address template "201-vmss-ubuntu-autoscale", and download Azuredeploy.json and Azuredeploy.parameters.json file.
- First open the Azuredeploy.json file, a basic arm template in addition to basic information such as schema and Contecntversion, contains 3 parts: parameters,variables,resources
?
Parameters: Define the parameter values you want to enter externally, such as the size of the virtual machine, the name of the image, and so on
Variables: Some of the default variables, such as storage type, network address, API version, etc.
Resources: The systems and services you use, such as networking, virtual machine extensions, load balancing, and more
?
- Open Azuredeploy.json file, first need to modify Ubuntu image, in China the latest version of Ubuntu 14 is 14.04.3-lts
Modified to:
- All stored endpoint addresses are global and need to be modified to China:
Modified to:
?
?
- For the storage of Linux diagnostics endpoint, this place should pay special attention, in addition to the need to modify the storage endpoint, but also need to add storage metrics table endpoint, Otherwise the entire VMSS cannot collect the correct data to the corresponding table, nor does it work:
Modified to:
?
- Let's take a look at auto scaling, when you define auto scaling, you can first determine a capacity, such as the minimum number of VMS, the default number, and the maximum number of extensions:
Then we need to define the rules for auto-scaling, under what circumstances to increase the instance, under what circumstances to reduce the instance, in this example, we define the processor's percentusertime, every 1 minutes to collect data, every 5 minutes as a time window, if the average value is greater than 60%, then automatically expand, Add one instance at a time:
- From the above steps can be seen, you get the template on GitHub can not be used directly, because there are more parameters for the global azure, need to make some changes, directly modify the template I have been shared on GitHub above, you can also go to the following address download use:
Https://github.com/kingliantop/azurelabs/tree/master/AzureChinaARMTemplate/VMSS-Linux-Autoscale
- Open the parameter file Azuredeploy.parameters.json, this file is where you set parameters for the template, such as what kind of VM size you want to use, user name password, how many VMs to start with, etc.:
For example, my parameter file is as follows:
Deploying auto-extended Linux VMSS using arm templates (1)