how can I configure availability sets in azure? - azure

I am not very familiar with this in azure.
I created one centos vm, I created an availability set, in order to enable auto scaling I need to create another VM in the same availability set.
so I will create another vm, with the same image.
So, these 2 vms will replicate each other? if I install something in one VM, will it be replicated automatically to the other vm?, should I use only one of the vms as the starter point to install and configure things?
or should I do everything manually on each VM? Example, if I open port 80 in one I should do it in another?, if I install magento in one, I should install it in the other?

Azure will not replicate your VMs automatically. There are some manual steps involved:
You need to prepare one VM as a starter point.
Then you manually clone VMs up to a maximum number that you will need.
Make sure all they are in the same availability set.
Set up auto scaling
Now Azure will scale automatically by turning some of your VMs on and off. When VM is turned off, you will only incur storage costs for it. And storage in Azure is almost free.

To answer your first question: How to configure availability set
I created a post covering this on How to guard your application from azure outages
Use the quick create to stand up a VM of your choice
Once the instance is running click on the configure tab and create a new availability set
Click save
Saving will force a shut down, reconfigure, startup process
Once the VM comes back online you can create a 2nd VM
Using the create from gallery option, click through all the create screens until you get to the configure virtual machine screen (screen 4 at the moment)
Select the cloud service that was created with your first VM (availability sets require the VM's to run in the same cloud service)
Then select the availability set you created for the first VM
Finish the creation of your second VM
You can now see the linked VM's in the same availability set by clicking on the configure tab for any VM in the availability set you created. It will list all VMs in a given availability set inside the details of the VM

Related

How to schedule to change VM resources in azure?

I have 4 VMs in azure and I am trying to set up a schedule to lower the RAMs and CPU cores for after-hours and revert them back to their original size during business hours.
can someone guide me through the steps or share a how-to resource, please? I can't find any documents and I am sure my search key is not correct.
Thanks
As suggested by #harshavmb, you can make use of VMSS.
In Azure, Auto-Scaling is possible if you make use of Virtual Machine Scale-Sets.
Virtual Machine Scale-Sets allows you to automatically scale as resource demand changes.
Based on schedules, you can create auto scale rules.
These schedule-based rules allow you to automatically scale the number of VM resources at fixed times.
To create the Auto-Scale rule, you can make use of following tools:
Azure PowerShell
Azure CLI
Azure template
Otherwise, you can create an automation account in Azure and execute runbooks as mentioned in below link if helpful:
Automatically Resize an Azure VM - Automation account

Azure VMs and load balancing

am new to windows azure. I recently set up a vm and host a website, according to the SLA i need to have 2 VMs in the availability set. Now i did set up the second VM.
My questions what do i need to use the second VM for?
if i setup load balancing does azure redirect user to the second VM? this second VM has nothing in it.
Please i will like to know this and is it possible to replicate the content of the first VM to the second one, so each time the first one is down the second VM can take over.
Thanks
At first, You must understand the statement of minimum two machines to get 99.95% SLA. It is not about "reserving" resources for use in case of fault or update (fault domain and update domain in availability set). Your application must be created as multi-tenant, so You need to run Your application on two servers, connected to the availability set. You can synchronize storage with GlusterFS (if You use Linux) or other distributed file system. You also can use Azure Files service (SMB as a service) to share storage. For sharing DB (in example MySQL) You need a cluster (independent or distributed through Your two machines).
So... You must to start think in "cloud way" instead of typical one VM administration.

unable to add a vm to an Availability Set in azure

I just created a standard vm inside Azure, and created a new Availability set.
I created another vm, with the same specs, in the same region, but when I go to configurare the availability set I don't see it in the list.
I'm missing something?
Luca
So... just posting this as an answer, to properly close the loop based on the comments under the question:
When setting up a Virtual Machine, you can choose which Cloud Service to place the Virtual Machine in. The Cloud Service is essentially a container which gets assigned a specific IP address, gets a cloudapp.net name (e.g. myservice.cloudapp.net), and gets assigned to a region (or affinity group, which is region-specific).
Availability Sets are specific to a given Cloud Service. You may place any of your Cloud Service's VMs in the same Availability Set (or even have multiple Availability Sets, with groups of VMs assigned to specific Availability Sets). However: An Availability Set does not span across Cloud Services.
So: When you went to set up your second Virtual Machine, and you didn't see your Availability Set, that is because you were attempting to deploy to a different Cloud Service.
Below screenshot shows the wizard page where we can select existing cloud service to which we can associate a new VM

How to autoscale virtual machines(IaaS approach) in azure

How to autoscale virtual machines(IaaS approach) in azure instead of web/worker role autoscaling in azure?
You can now Autoscale Virtual machines in Azure directly in the Azure Management Portal. ScottGu has a post about it on his blog.
The important thing to autoscale VM's is you must proactively provision the Max # of VM's you think you'll need to handle your peak capacity, and add them to the same availability set.
For example, if on the busiest day of the week it takes 6 machines to handle all of your traffic, then you need to create 6 instances and install your application on it, configure it to handle traffic etc.... and then add it to an availability set with the other 5 machines.
Once you've done this, you can navigate to the Cloud Service that contains all of your virtual machines and click on the Scale tab. You should see a list of your availability sets, and it should tell you the # of machines you can scale over. Choose a metric (either CPU or Queue today), and then range of machines you want to scale between. You can scale between 1 and the total # of machines.
When load is low -- Azure will turn off machines (so you don't have to pay for them), and when load is high, Azure will turn those machines back on.
Auto-scaling on the IaaS level doesn't really make sense. Even if azure could detect high CPU usage and start a new VM based on it, what then? you still need to install your application on that VM automatically somehow.
What you are looking for is something that runs your app on azure, and installs new instances on new VM's if necessary. That "something" is called PaaS enabler. Basically it is another abstraction level between your app and the azure IaaS.
there are a couple of them out there :
Cloudify, CloudFoundary, Juju
as far as i know, only one that supports Azure is Cloudify. you can check out how to configure azure using Cloudify here : Configuring Azure
you can also check out the community - Cloudify Forum, or post questions here for assistance.
Disclaimer: I work for Gigaspaces, developing the Cloudify product line.
According to this it's possible to scale out IaaS with Availability sets by pre-provisioning the number of boxes: https://blogs.msdn.microsoft.com/kaevans/2015/02/20/autoscaling-azurevirtual-machines/

Adding Azure Virtual machine to an existing availability set

I want to create two virtual machines in Azure which should not be connected to each other. I created first virtual machine and also created an availability set as part of its creation process.
Now when I create the second virtual machine then I don't get the availability set created as part of first virtual machine in the drop down list of availability sets.
However if I try to connect the second virtual machine as part of first one then I am able to see the availability set created as part of first virtual machine.
Is it mandatory for virtual machines to be connected to each other so that I can add them to the same availability set? Is this a limitation only from azure portal and there is a workaround using powershell?
UPDATE:
If we connect two virtual machines then we can get the benefit of availability set. However, at the same time both virtual machine becomes part of same cloud service and hence are load balanced by azure which does not support sticky session.
My scenerio is that I have identical front-ends which needs to support sticky session. Therefore I don't want to connect them to each other. However, I want to get the benefits of availability sets as mentioned in the article on Availability sets.
So can I set availability set for two identical virtual machines not connected to each other?
The term "Availability Set" means that you want to bring one or more VM within one service group for maximize the availability during an event of downtime. So what you see on Azure Portal is correct behavior however you might have some misunderstanding with regard to Availability Set. You can read more on "Availability Set" here.
So when you try to connect second virtual machine as part of first, you do see the availability set, because this way you want your VM to use the settings from the first and add another VM to the same group to maximize the availability. This second VM becomes the part of first one.
When you create an independent VM (call is second or 3rd or any) you are actually creating a brand new VM which is going to run independent to any other VM you may or may not have and thats why you dont see "availability set" instead you can create a new "availability set" based on this new VM.
Set AvailabilitySet using Powershell
Get-AzureVM -ServiceName "savilltech101" -Name "WebSrv3" | Set-AzureAvailabilitySet -AvailabilitySetName "IIS" | Update-AzureVM

Resources