Configuring AOAG on SQL for XenMobile

The purpose of this Blog is to provide detailed information on setting up Always on Availability Group on SQL Servers and use this AOAG enabled Database for XenMobile 10 environment. This includes step by step instructions for AOAG configuration. For this activity, you would need the following: At least 2 Instance of SQL 2012 Enterprise VMs in the same Domain Active Directory Environment Windows Failover Cluster CIFS Share on any windows Machine or a File Server. Service Account (Domain User account) which is also used as a SQL Administrator in this lab setup ( with RW access to the CIFS share) Term Definition AOAG Always on Availability Group WSFC Windows Server Failover Cluster   Disclaimer The Hostnames, Usernames and IP Addresses used in the screenshots are for the illustration purposes only. Please use the appropriate Hostnames, Usernames and IP Addresses from your environment.   Pre-Requisites Machine Details AD Windows Server 2012 Virtual

Source: Configuring AOAG on SQL for XenMobile | Citrix Blogs

Advertisements

How to install unsigned windows drivers

Windows 7 natively blocks the installation of unsigned drivers, thus making the device/peripherals you want to connect to your computer useless.

Disable signature verification of drivers:

  • Go to Start Menu > Run and type the following command:
    • bcdedit /set nointegritychecks ON
  • Restart the PC and install the unsigned driver

Enable signature verification of drivers:

  • Go to Start Menu > Run and type the following command:
    • bcdedit /set nointegritychecks OFF
  • Restart your PC

Deploy a Hyper-V Cluster

Windows 2012 R2 with Hyper-V and failover clusters limitations:

  • The failover cluster can have a maximum of 64 nodes.
  • You can have a maximum of 8,000 virtual machines per cluster for server computer virtualization, with a maximum of 1,024 virtual machines on a single node, provided that the server hardware has the resources to support them. For example, when Hyper-V is used together with Virtual Desktop Infrastructure (VDI) for client computer virtualization, you can have a maximum of 8,000 VDI (Windows 8.1, Windows 8 or Windows 7) virtual machines per cluster, with a maximum of 1,024 on a single node.

 

Use the following instructions to connect your selected servers to networks and storage.

To connect the servers to the networks and storage

  1. For details about the kinds of network adapters and device controllers that you can use with a failover cluster, review Prerequisites, earlier in this topic.

  2. Connect and configure the networks that the servers in the cluster will use.

    System_CAPS_noteNote
    If you want to include clients or a non-clustered domain controller as part of your test configuration, make sure that these computers can connect to the failover cluster servers through at least one network.
  3. Follow the manufacturer’s instructions for physically connecting the servers to the storage.

  4. Ensure that the disks (LUNs) that you want to use in the cluster are exposed to the servers that you will cluster (and only those servers). You can use either of the following interfaces to expose disks or LUNs:

    • The interface provided by the manufacturer of the storage.
    • An appropriate iSCSI interface.
  5. If you have purchased software that controls the format or function of the disk, follow the instructions from the vendor about how to use that software with Windows Server 2012 R2 or Windows Server 2012.

  6. On one of the servers that you want to cluster, in Server Manager or in Disk Management, confirm that the cluster disks are visible.

  7. If you want to have a storage volume larger than 2 terabytes, and you are using the Windows interface to control the format of the disk, convert that disk to the partition style called GUID partition table (GPT). To do this, back up any data on the disk, and delete all volumes on the disk. Then, in Disk Management, right-click the disk (not a partition), and click Convert to GPT Disk.

    For volumes smaller than 2 terabytes, instead of using GPT, you can use the partition style called master boot record (MBR).

    System_CAPS_importantImportant
    You can use either the MBR or the GPT partition style for a disk that is used by a failover cluster, but you cannot use a disk that you have converted to dynamic by using Disk Management.
  8. Check the format of any exposed volume or LUN. We recommend NTFS for the format (for the quorum witness disk, you can use NTFS or ReFS).

 

To install the Hyper-V role and the Failover Clustering feature on each physical computer, see the following procedures:

 

Perform this step on both physical computers if you did not create the virtual switch when you installed the Hyper-V role. This virtual switch provides the highly available virtual machine with access to the physical network.

To create a virtual switch

  1. Open Hyper-V Manager.

  2. From the Actions menu, click Virtual Switch Manager.

  3. Under Create virtual switch, select External.

  4. Click Create Virtual Switch. The New Virtual Switch page appears.

  5. Type a name for the new switch. Make sure you use exactly the same name on both servers running Hyper-V.

  6. Under Connection Type, click External network, and then select the physical network adapter.

  7. Click OK to save the virtual network and close Virtual Switch Manager.

PowerShell LogoWindows PowerShell equivalent commands

The following Windows PowerShell cmdlet or cmdlets perform the same function as the preceding procedure. Enter each cmdlet on a single line, even though they may appear word-wrapped across several lines here because of formatting constraints.

The following example creates the external switch VMExternalSwitch, which binds to the network adapter Wired Ethernet Connection 3 and allows the management operating system to share the network adapter.

New-VMSwitch "VMExternalSwitch" –NetAdapterName "Wired Ethernet Connection 3" –AllowManagementOS

 

Before you create the cluster, we strongly recommend that you run a full validation test of your cluster configuration by running the Validate a Configure Wizard in Failover Cluster Manager, or the Windows PowerShell Test-Cluster cmdlet. Specific validation tests are included for the configuration of the Hyper-V role in the failover cluster.

For detailed considerations and steps to validate the cluster, see Validate Hardware for a Failover Cluster.

 

To create a failover cluster by using Failover Cluster Manager or the Windows PowerShell New-Cluster cmdlet, see Creating a Windows Server 2012 Failover Cluster.

 

To implement certain scenarios for clustered virtual machines, the virtual machine storage and virtual hard disk file should be configured as Cluster Shared Volumes (CSV). To configure a disk in clustered storage as a CSV volume, you can use Failover Cluster Manager or the Windows PowerShell Add-ClusterSharedVolume cmdlet. For detailed planning considerations and steps to create CSV, see Use Cluster Shared Volumes in a Windows Server 2012 Failover Cluster.

CSV can enhance the availability and manageability of virtual machines by enabling multiple nodes to concurrently access a single shared storage volume. For example, on a failover cluster that uses CSV, multiple clustered virtual machines that are distributed across multiple cluster nodes can all access their virtual hard disk files at the same time, even if the files are on a single disk (LUN) in the storage. This means that the clustered virtual machines can fail over independently of one another, even if they use only a single LUN. CSV also support live migration of a Hyper-V virtual machine between nodes in a failover cluster.

 

In this step, you create a virtual machine and configure it for high availability.

System_CAPS_noteNote
You can run the Hyper-V New Virtual Machine Wizard directly from Failover Cluster Manager. After the virtual machine is created in this way, it is automatically configured for high availability.
  • Starting in Windows Server 2012, we do not support the configuration where there is more than one virtual machine in a virtual machine clustered role. An example of this is a scenario where multiple virtual machines have files on a common physical disk that is not part of CSV. A single virtual machine per clustered role improves the management experience and the functionality of virtual machines in a clustered environment, such as virtual machine mobility.
  • Choose the shared storage as the location to store the virtual machine and the virtual hard disk. Otherwise, you will not be able to make the virtual machine highly available. To make the shared storage available to the virtual machine, you must create the virtual machine on the physical computer that is the node which owns the storage.
  • If you created a CSV volume in Step 6: Add a disk as CSV to store virtual machine data, in the settings for the virtual hard disk, specify the CSV volume as the location of both the virtual machine and the virtual hard disk.
  • Ensure that you select a virtual hard disk option that is appropriate for the method you are using to install the guest operating system on the virtual machine (for example, from physical media or from an .iso file).

To create a highly available virtual machine

  1. In Failover Cluster Manager, select or specify the cluster that you want. Ensure that the console tree under the cluster is expanded.

  2. Click Roles.

  3. In the Actions pane, click Virtual Machines, and then click New Virtual Machine. The New Virtual Machine Wizard appears. Click Next.

  4. On the Specify Name and Location page, specify a name for the virtual machine, such as FailoverTest. Click Store the virtual machine in a different location, and then type the full path or click Browse and navigate to the shared storage.

  5. On the Assign Memory page, specify the amount of memory required for the operating system that will run on this virtual machine. For example, specify 1024 MB to run Windows Server 2012 R2.

  6. On the Configure Networking page, connect the network adapter to the virtual switch that is associated with the physical network adapter. You should specify the virtual switch that you configured in Step 3: Create a virtual switch.

  7. On the Connect Virtual Hard Disk page, click Create a virtual hard disk. If you want to change the name, type a new a name for the virtual hard disk. Click Next.

  8. On the Installation Options page, click Install an operating system from a boot CD/DVD-ROM. Under Media, specify the location of the media, and then click Finish.

    The virtual machine is created. The High Availability Wizard in Failover Cluster Manager then automatically configures the virtual machine for high availability.

PowerShell LogoWindows PowerShell equivalent commands

The following Windows PowerShell cmdlet or cmdlets perform the same function as the preceding procedure. Enter each cmdlet on a single line, even though they may appear word-wrapped across several lines here because of formatting constraints.

The following example creates the virtual machine FailoverTest, specifying that it will be installed from a .iso file, and configures it for high availability.

New-VHD -Path <PathToVHDXFile> -Dynamic -SizeBytes 127GB
New-VM -Name FailoverTest -Path <PathToVMFolder> -Memory 1GB –SwitchName "VMExternalSwitch" –BootDevice CD -VHDPath <PathToVHDXFile>
Add-VMDvdDrive -VMName FailoverTest –Path <PathtoISOFile>
Set-VM –Name FailoverTest –AutomaticStartAction Nothing
Add-ClusterVirtualMachineRole -VirtualMachine FailoverTest

 

You then start the clustered virtual machine that you configured in Step 7: Create a highly available virtual machine. This installs the guest operating system (which, in this topic, is assumed to be Windows Server 2012 R2). To do this, see Step 3: Install the guest operating system in “Install the Hyper-V Role and Configure a Virtual Machine.”

System_CAPS_noteNote
If you are installing an operating system other than Windows Server 2012 R2 on a Windows Server 2012 R2 Hyper-V host, or an operating system other than Windows Server 2012 on a Windows Server 2012 Hyper-V host, you might also need to install Hyper-V integration services for the operating system.

 

To test a planned failover, you can move the clustered virtual machine that you created in Step 7: Create a highly available virtual machine to another node.

You have the following options to move a clustered virtual machine:

  • Live migration   Move ownership of the clustered virtual machine to another node without pausing the role.
  • Quick migration   Pause the virtual machine, save state, move the role to another node, and start the virtual machine on the other node.
  • Storage migration   Move only the virtual machine data to other clustered storage.

For example, to test a planned failover by performing a live migration, you can use Failover Cluster Manager or the Windows PowerShell Move-ClusterVirtualMachineRole cmdlet.

To test a planned failover

  1. In Failover Cluster Manager, select or specify the cluster that you want. Ensure that the console tree under the cluster is expanded.

  2. To select the destination node for live migration of the clustered virtual machine, right-click FailoverTest (the clustered virtual machine that you configured in Step 7: Create a highly available virtual machine), point to Move, point to Live Migration, and then clickSelect Node.

    As the FailoverTest virtual machine is moved, the status is displayed in the results pane (center pane). Optionally, you can repeat this step to move the virtual machine to an additional node or back to the original node.

  3. Verify that the move succeeded by inspecting the details of each node.

PowerShell LogoWindows PowerShell equivalent commands

The following Windows PowerShell cmdlet or cmdlets perform the same function as the preceding procedure. Enter each cmdlet on a single line, even though they may appear word-wrapped across several lines here because of formatting constraints.

The following example live migrates the virtual machine FailoverTest to the node ContosoFCNode2.

Move-ClusterVirtualMachineRole -Name "FailoverTest" –Node ContosoFCNode2


 

To test an unplanned failover of the clustered virtual machine, you can stop the Cluster service on the node that owns the clustered virtual machine.

To test an unplanned failover

  1. In Failover Cluster Manager, select or specify the cluster that you want. Ensure that the console tree under the cluster is expanded.

  2. To minimize disruption to clients, before stopping the Cluster service on a node, move the clustered roles that are currently owned by that node (other than FailoverTest) to another node by doing the following:

    1. Expand the console tree under the cluster that you want to manage, and then expand Nodes.
    2. Select the node that owns the clustered virtual machine FailoverTest (the clustered virtual machine that you configured in Step 7: Create a highly available virtual machine).
    3. Select all of the clustered roles on the node, except FailoverTest.
    4. To select the destination node for the selected clustered roles, right-click the roles, point to Move, and then click Select Node

    It might take several minutes to move the clustered roles to the destination node.

  3. Expand the console tree under Nodes.

  4. Right-click the node that owns FailoverTest, point to More Actions, and then click Stop Cluster Service.

    The virtual machine moves to the other node. There might be a short delay while this happens.

PowerShell LogoWindows PowerShell equivalent commands

The following Windows PowerShell cmdlet or cmdlets perform the same function as the preceding procedure. Enter each cmdlet on a single line, even though they may appear word-wrapped across several lines here because of formatting constraints.

The following example stops the Cluster service on ContosoFCNode2, the node that owns the clustered virtual machine FailoverTest.

Stop-ClusterNode –Name ContosoFCNode2

 

To modify the configuration of a virtual machine, you can use the Failover Clustering tools or the Hyper-V tools to access the settings. We recommend that you use the Failover Clustering tools to access the virtual machine settings. When you do this, the cluster is updated automatically after you apply the new settings, and you are able to modify all of the virtual machine settings. However, if you make changes to the virtual machine settings by using the Hyper-V tools directly, you must update the cluster manually after you make the changes, and you will be prevented from modifying certain virtual machine settings or performing actions that could conflict with settings for the failover cluster. In addition, if the configuration is not refreshed after changes are made, a subsequent failover may not succeed, or it may succeed but the virtual machine will then be configured incorrectly.

System_CAPS_noteNote
To modify certain virtual machine settings, you may be prompted to first shut down the virtual machine.

To modify the settings of a virtual machine

  1. In Failover Cluster Manager, select or specify the cluster that you want. Ensure that the console tree under the cluster is expanded.

  2. If you need to shut down the virtual machine before modifying the settings, expand Roles, right-click FailoverTest(the clustered virtual machine that you configured in Step 7: Create a highly available virtual machine), and then click Shut Down.

  3. Right-click FailoverTest, and then click Settings. The Settings page for the virtual machine appears.

  4. Configure the settings for the virtual machine, and then click OK.

    The virtual machine configuration is updated in the failover cluster.

  5. If you previously shut down the clustered virtual machine, right-click FailoverTest, point to More Actions, and then click Start Role.

Use the following procedure to manually refresh the virtual machine configuration in the failover cluster

To manually refresh the virtual machine configuration in the failover cluster

  1. In Failover Cluster Manager, select or specify the cluster that you want. Ensure that the console tree under the cluster is expanded.

  2. Right-click FailoverTest (the clustered virtual machine that you configured in Step 7: Create a highly available virtual machine), point to More Actions, and then click Refresh Virtual Machine Configuration.

PowerShell LogoWindows PowerShell equivalent commands

The following Windows PowerShell cmdlet or cmdlets perform the same function as the preceding procedure. Enter each cmdlet on a single line, even though they may appear word-wrapped across several lines here because of formatting constraints.

The following example refreshes the configuration of the clustered virtual machine FailoverTest.

Update-ClusterVirtualMachineConfiguration –Name "FailoverTest"

 

When you want to remove a virtual machine from a cluster, the procedure you need to use varies depending on whether you want to keep the virtual machine and its files. This step illustrates both scenarios.

Scenario A: To remove a virtual machine from a cluster and retain the virtual machine

  1. Use Failover Cluster Manager to take the virtual machine offline. Under Roles, right-click FailoverTest (the clustered virtual machine that you configured in Step 7: Create a highly available virtual machine), point to More Actions, and then click Stop Role.

  2. Optionally, export the virtual machine. Exporting a virtual machine allows you to move the virtual machine to another server running Hyper-V, such as a non-clustered server. To do this:

    1. Switch to Hyper-V Manager and verify that the FailoverTest virtual machine is selected.
    2. Under Actions, click Export.
    3. Type or browse to specify a location in which to export the virtual machine, and then click Export.
    System_CAPS_importantImportant
    If you plan to import the virtual machine to another cluster, use either Hyper-V Manager or Microsoft System Center Virtual Machine Manager. If you import a virtual machine using Hyper-V Manager, afterwards, configure the virtual machine by using the High Availability Wizard in Failover Cluster Manager, or the Windows PowerShell Add-ClusterVirtualMachineRole cmdlet.
  3. In Hyper-V Manager, verify that the FailoverTest virtual machine is selected. Under Actions, click Delete.

  4. In Failover Cluster Manager. expand Roles, right-click FailoverTest, and then click Remove.

    The virtual machine is removed from the cluster.

Scenario B: To remove a virtual machine from a cluster and delete the virtual machine

  1. Use Failover Cluster Manager to take the virtual machine offline. Under Roles, right-click FailoverTest (the clustered virtual machine that you configured in Step 7: Create a highly available virtual machine), point to More Actions, and then click Stop Role.

  2. Switch to Hyper-V Manager and select the FailoverTest virtual machine. Under Actions, click Delete.

  3. In Failover Cluster Manager, expand Roles, right-click FailoverTest, and then click Remove.

    The virtual machine is removed from the cluster.

  4. Manually delete the virtual machine and the virtual hard disk from the shared storage.

Windows Server 2012 Virtual Use Licensing

Server 2012 Standard includes two virtual use licenses, while Datacenter includes unlimited and the free Hyper-V Server doesn’t include any

Virtual use licenses are only allowed so long as the host server is not running any other role other than Hyper-V

You can convert from standard to datacenter by entering the following command at the command prompt:

dism /online /set-edition:ServerDatacenter /productkey:48HP8-DN98B-MYWDG-T2DCC-8W83P /AcceptEULA

The key above is a generic MS activation key so after the upgrade is completed enter your MAK or KMS key to activate the server

Turn On/Off Windows Server 2012 GUI with PowerShell

Turn GUI Off with PowerShell

Get-WindowsFeature *gui* | Uninstall-WindowsFeature –Restart
Once rebooted, you will only have the command line and no GUI

Turn GUI On with PowerShell

Get-WindowsFeature Server-Gui-Mgmt-Infra, Server-Gui-Shell | Install-WindowsFeature –restart
Once rebooted, you will have the GUI