Lab 24: VMware vSphere Distributed Resouces Scheduler

Reference Project Architecture: infrastucture

In this lab, I am going to perform how to work with VMware vSphere Distributed Resources Scheduler (DRS).

VMware vSphere Distributed Resource Scheduler (DRS) is a utility that balances computing workloads with available resources in a virtualized environment. It helps to manage a cluster of physical hosts as a single computer resource.

For example, when you assign a VM to a cluster, DRS finds a suitable host for that VM to run. DRS helps to distribute load balanced across the cluster by places VMs an appropriate host to enforce cluster-wide resource allocation policies including reservation, priority and limits. When a VM is powered on, DRS produces an initial placement of the VM on a host according to the resources allocation and load balance. DRS uses vMotion to migrate VM to other hosts when it requires. Additionally,  When a new physical server is added to a cluster, DRS allows VM to immediately take benefit of the newly allocated resources because it distributes the running VMs.

VMware vSphere DRS benefits include:

  • Dedicated infrastructures for individual business units
  • Centralised control of hardware parameters
  • Continuous monitoring of hardware utilisation
  • Load Balancing
  • Virtual Machine Placement
  • Resource Pools
  • Coordinating the Storage DRS
  • Prioritisation of resources according to application importance
  • Downtime-free server maintenance
  • Optimisation of energy efficiency
  • Power Management and Reduction of cooling costs

The task lists for the lab 24: 

  1. Create a Load Imbalance
  2. Create a DRS Cluster
  3. Verify Proper DRS Cluster Functionality
  4. Create, Test, and Diable a VM-VM Affinity Rule
  5. Create, Test, and Disable an Anti-Affinity Rule
  6. Create, Test, and Disable a Virtual Machines to Host Affinity Rule

Prerequisites:

  • Log in the VMware vSphere web client portal: https://vCenter Server Appliance Name.domainname:9443/vshpere-client/# or VMware vSphere Client via root user and password. 0login.jpg

Steps for the task: Create a Load Imbalance

In this task, I will perform how to create a load imbalance across the hosts.

Step 1: Before creating a load Imbalance, You need to migrate all the VMs to one host. You need minimum four VMs on one host to testing imbalance activity. If all of your VMs are not the same host, Migrate them by using the VMware vSphere vMotion.

Step 2: Go to Home ->vCenter -> Hosts and Clusters 1-1.jpg

Step 2: Select Lab Cluster [ I named my cluster as Lab Cluster] and Click the Related Objects -> Virtual Machines tab in the  inventory2.jpg

Step 3: Power on each of your VMs by clicking on “Power On” icon or Right click each VM and select Power On.4.jpg

Step 4: I ran “cpubusy.vbs” script on each of four VMs for making CPU busy of VMs. You need to start an instance of the “cpubusy.vbs” with command prompt[ I hope your instructor gave it to you before performing this lab]. Right click on “cpubusy.vbs” and Select “Open with Command Prompt“. and run this script on your four VMs for making CPU busy running.

5.jpg6.jpg

Steps for the task: Create a DRS Cluster

A DRS Cluster is the group of VMware ESXi hosts and those hosts are associated VM with shared resources and a shared management interface.

Step1: Select Home -> vCenter -> Hosts and Clusters. Righ click on the “Lab Cluster” [ lab Cluster is my cluster name, name of the cluster can be different based on user preference] and select “Setting2.jpg

Step2: Select vSphere DRS and Click “Edit3.jpg

Step3: Select DRS Automation level “Manual“. Note: DRS offers three level of automation: Manual, Partially Automated, Fully Automated. Manually Automated means DRS will give you a recommendation based on DRS affinity, anti-affinity rules, Resource availability and workload of the system. 

Manually Automated means DRS will give you a recommendation based on DRS affinity, anti-affinity rules, Resource availability and workload of the system. You need to apply that recommendation manually on your system.

Now select the Migration Threshold: Aggressive. Note: In the production Environment, Company usually maintains the central position as a default threshold. Click OK to apply the changes4.jpg

Migration Threshold:  In this lab, I tested HA with aggressive migration threshold because I wanted to migrate VMs faster. But real practice is in the production environment, they keep it in the center. 5.jpg

Steps for the task: Verify Proper DRS Cluster Functionality

In this task, I will demonstrate how to verify the proper DRS Cluster Functionality

Step 1: Click Home->vCenter->Hosts and Clusters. From the “Lab Cluster” inventory object, click “Monitor” and click on the “vSphere DRS” tab. Click on the “Run DRS Now” button. Note: When you clicking on “Run DRS Now“, immediately DRS start to evaluate the cluster and provide the recommendation without waiting standard time period 5 minutes before generating recommendations.

1.jpg

2.jpg

Step 2: Now Click on the Summary tab of lab Cluster to check the vSphere DRS status for checking load imbalance. Now you can see on the screenshot, the load is imbalanced.3

Step3: Go to the monitor->vSphere DRS -> CPU Utilisation. In this Screenshot, you can see “Sum of the Virtual machine CPU utilisation -per host” status. Host one:vesxi01 is more than 50% occupied, on the other hand, the esxi02 host is 0% CPU utilizations.4.jpg

Step 4: Now click on Recommendations tab, Click on “Run DRS Now” again and “Apply Recommendations” button 5.jpg

Step 5: Press the “Refresh” button in the vSphere Web Client after waiting a few minute. You will see in the Recent Tasks, The VM has started spread across the two hosts.7.jpg

Step 6: Result of the DRS functionality:  The following screencast you can see the workload has been balanced between two hosts simultaneously. 8.jpg9.jpg10.jpg11.jpg

Go to the Virtual machine, Press Ctrl + C to stop “cpubusy.vbs” in each machine. After that, Close the VM console

Steps for the task: Create, Test, and Diable a VM-VM Affinity Rule

A VM-VM Affinity rule means the selected individual VM should run on the same host or be kept on a separate host based on the type selection during configuring affinity rule. Affinity Rule applied for keep VMs in the same host. On the other hand, Anti-Affinity rule is kept VMs on a separate host.

Step1: Select Lab Cluster in the inventory, Click the “Related objects” and click the Virtual Machines” tab. You can see two VM machines has been running on the each host. 1.jpg2.jpg

Step2: Right Click ” Lab Cluster” and select “Settings”. 3.jpg

Step 3: Select “DRS Rules” and Click “Add“. A Cluster setup dialogue box is displayed.4.jpg

Step 4: In the name section, give an Appropriate name ” Co-locate your name VMs” as an example. This the “Enable Rule” and Type: “Keep Virtual Machine together“. Now Click on “Add5.jpg

Step 5: Select the VMs machines which you want to include in the affinity rule of keep VMS together. I selected four objects.6.jpg

Step 6: Click “OK” after all setup done. The result of the rule will be “All the objects of VMs” I selected here is going to migrate to the same host.7.jpg8.jpg

Step 7: Select Monitor ->vSphere DRS -> Recommendations. Now click on “Run DRS Now” for evaluating the cluster configuration.9.jpg

Click on “Apply Recommendations“. 10.jpg

Now you can monitor Recommendation is applied from “Recent Tasks“.The recommended VMs has migrated to the recommended host using vMotion interface.11.jpg

Step 8: Testing the Affinity rule: Now you can see the effect of the affinity rule. Click “Related Objects” -> Virtual machines tab and check the “Host” column. All of the VMs are running now “esxi02 host” after applied the affinity rule.

Note: If you don’t see the “Host” column on the window. Click the right button of the mouse on the status column heading bar and select “show and hide column” and select “Host”.12.jpghost column.jpg

Step 8: Disable the affinity Rule: Right-click on “Lab Clusterin the inventory object and select “Settings”. 13.jpg

Step 9: Select the “Affinity Rule” from the “DRS Rules” and click “Edit”14.jpg

Step 10: Uncheck the “Enable Rule” to disable the affinity rule on the system. Click “Ok15.jpg

Steps for the task: Create, Test, and Disable an Anti-Affinity Rule

In this task, I am going to show how to configure an Anti-Affinity Rule, testing, Disable and delete it. When you apply an Anti-Affinity rule on the DRS Cluster, DRS assures that the specific VMS are kept on the separate hosts.

Step 1: Right-Click “Lab Cluster” in the inventory and select “Settings1.jpg

Step 2: Select the “DRS rules” pages and Click on “Add“.2.jpg

Step 3: Perform the following action to create an Anti-Affinity rule” that I showed on the following Screenshot.3.jpg4.jpg5.jpg6.jpg

Step 4: Go to the “Monitor ->vSphere DRS” tab.  On the Recommendations page, Click on ” Run DRS Now”7.jpg

Now click on the “Apply Recommendations” button to enforce the anti-affinity rule.8.jpg

Now you can monitor the process migration from the “Recent Tasks”. The VMs with anti-affinity rules applied to them are migrated to another ESXi host in the cluster.9.jpg

Step 5: Testing the Anti-Affinity Rule: Go to the “Related Objects” and Virtual machines. Click the host column, you can see that one VM is now running on the separate ESXi hosts.10.jpg

Step 6: Disable and Delete the Anti-Affinity Rule:  Right-click on the “Lab Cluster” from the inventory objects and select “Settings”11.jpg

Select the “DRS Rules” in the left pane and click the rule that you created for anti-affinity and click “Edit”.  Deselect the “Enable Rule” for disable anti-affinity rule in the cluster.12.jpg

Click on the “Delete” button to delete the “Anti-Affinity rule” from the cluster. Click “Yes” to delete the DRS rule.13.jpg14.jpg

Steps for the task: Create, Test, and Disable a Virtual Machines to Host Affinity Rule

The rule of the Virtual Machines to host Affinity specifies that the members of a selected virtual machine DRS group can run on the members of a specific host DRS group based on the rule configuration.

Step1: Create a Virtual Machines to Host Affinity Rule: Right click on the Lab Custer – > Settings1.jpg

Select “DRS Groups” in the left pane of the settings page and Click “Add”2.jpg

Now you get a Create DRS Group wizard. Type the name of the group and select the type as ” VM DRS Group”3.jpg

Select the list of the VMs object on which you want to apply this rule.4.jpg5.jpg

Now you need to create another group ” Host DRS Group”.7.jpg

Type the appropriate Name and select the type of the group: Host DRS Group“. Then “Ok8.jpg9.jpg

Select the host group from the cluster and In my case, I selected both hosts for checking the balance in the cluster. 10.jpg11.jpg12.jpg

Now you need to go DRS rules for applying the group setup. DRS rules -> Add. Give the name of the rule appropriate name and select ” Enable Rule”. VM and host group Select that DRS Group, you already created for VM and Host groups.  And Select “Must run on the host in groups” condition.14.jpg

Click “Lab Cluster” -> Monitor-> vSphere DRS tab. Click “Run DRS Now. After clicking on the run DRS now, DRS will start to evaluate the state of the cluster and make a recommendation based on the DRS rule. Then “Apply the Recommendations” 15.jpg16.jpg17.jpg2122.jpg23.jpg24.jpg25.jpg

Step 2: Testing the VM to host Affinity rule: 

For the testing purpose, I changed the DRS Host group. I applied this VM to Host Affinity Rules to the host one” vesxi01

21.jpg

Now you can see, after changing the host group. DRS recommended the VM to migrate the host vesxi01 that one was previously in the Esxi02 because of the effect of the VM groups. All VMS must run on the same group host.24.jpg25.jpg

In this task, I wanted to migrate a VM from vesxi01 to Esxi02. But It did not allow me to migrate because of the VM to host affinity rule violations cause. Click on “Cancel”26.jpg

Step 3: Disable the VM to host Affinity rule: Right click “Lab Cluster” in the inventory objects and select Settings. 13

Select DRS Rules in the left panel of the DRS cluster settings. Select the Rules: That you created, Click ” Edit” and deselect the “Enable Rule” to disable the VMs to Host affinity. Click “Ok”.

disable.jpg

Screencast: https://www.youtube.com/watch?v=Zc65vjlsMi8

Thank you 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s