Archive for December, 2016

Cluster OS Rolling Upgrade is a Windows Server 2016 feature that enables upgrade the operating system of the cluster nodes from Windows Server 2012 R2 to Windows Server 2016 without stopping the Hyper-V or the Scale-Out File Server workloads.

In this example we’ll upgrade Windows Server 2012 R2 cluster  to Windows Server 2016.

We have 2 nodes:cluster-01 and cluster-02

Backing up cluster configuration:

On both node install windows backup (if not already)

Install-WindowsFeature 'windows-server-backup' -IncludeManagementTools -IncludeAllSubFeature

1-1.PNG

1.PNG

1-2.PNG

1-3.PNG

1-4

1-5.PNG

Or with PowerShell:

wbadmin start backup -backupTarget:\\rd-sh\backup\ -include:C: -vssFull -quiet

If you are running Cluster Aware Updates (CAU), verify if CAU is currently running:

2

If it’s running,disable it:

Disable-CauClusterRole

Pause node:

Right-click node-Pause-Drain Node:

3.png

Or:

Suspend-ClusterNode -name cluster-02

4

Evict paused node from cluster:

Right click node-More Action-Evict:

5.png

Or:

Remove-ClusterNode -Name cluster-02

Upgrade node or delete it and create new VM with Windows Server 2016

I inserted Windows Server 2016 DVD and run setup

6

7.PNG

Only nothing was available for me

8.PNG

Install file server  (or Hyper-V if it’s Hyper-V cluster) and cluster role

install-windowsfeature fs-fileserver,failover-clustering -IncludeAllSubFeature -IncludeManagementTools

Add this node to cluster:

9.png

10

11

Or:

Add-ClusterNode -Name cluster-02 -Cluster test_cluster -NoStorage

Check cluster functional level:

get-cluster | select ClusterFunctionalLevel

12

If therer is any node with Windows Server 2012 Cluster functional level would be 8:(Mixed-OS mode: Windows Server 2012 R2 and Windows Server 2016 Failover cluster)

Repeat steps above for every node.When all nodes are upgraded to Server 2016 we can perform Cluster upgrade

Update-ClusterFunctionalLevel

 

13

Cluster Functional Level is now 9 (Windows Server 2016)

Advertisements

The iSCSI Target allows multiple servers to access stoarage on a Windows 2012 R2 simultaneously,and it can be added in to be made highly available through the Failover Cluster Manager

In this example we’ll be using 3 servers:

rd-sh.test.com (192.168.0.10) – Server with iSCSI virtual disk (iSCSI target)

iscsi-1.test.com (192.168.0.11)-Cluster member and iSCSI initiator (addedd disk from rd-sh.test.com)

iscsi-2.test.com (192.168.0.12)-Cluster member and iSCSI initiator (addedd disk from rd-sh.test.com)

Configuring iSCSI target (rd-sh.test.com):

Add-WindowsFeature fs-iscsitarget-server

Adding virtual iSCSI disk

New disk has F:letter

New-IscsiVirtualDisk -Path 'f:\storage.vhdx' -SizeBytes 59.8GB -ParentPath 'f:'
Add-IscsiVirtualDiskTargetMapping -TargetName 'mystorage' -Path 'f:\storage.vhdx'

Allowing access iscsi-1 (192.168.0.11) and iscsi-2 (192.168.0.12) to iSCSI virtual disk:

New-IscsiServerTarget -TargetName 'mystorage' -InitiatorIds Ipaddress:192.168.0.11,ipaddress:192.168.0.12

Configuring iscsi-1 and iscsi-2 servers (cluster members)

Connect to iSCSI initiator (rd-sh.test.com-192.168.0.10):

New-IscsiTargetPortal –TargetPortalAddress 192.168.0.10
$t=Get-IscsiTarget
Connect-IscsiTarget -NodeAddress $t.NodeAddress
Get-IscsiSession
$t=Get-IscsiSession
Register-IscsiSession -SessionIdentifier $t.SessionIdentifier

At this moment disk from rd-sh.test.com should be seen on both cluster members as offline:

get-disk

1.PNG

Initialize and format disk (on both cluster members)

Get-Disk | Where-Object IsOffline –Eq $True | Set-Disk –IsOffline $False
Initialize-Disk 1
New-Partition -DiskNumber 1 -UseMaximumSize -DriveLetter E
Format-Volume -DriveLetter E

Installing Cluster on iscsi-1 and iscsi-2 servers

From one of the future cluster member run:

invoke-command iscsi-1,iscsi-2 {Add-WindowsFeature fs-iscsitarget-server,Add-WindowsFeature failover-clustering -includemanagementtools}
New-Cluster 'iscsi_cluster' -Node iscsi-1,iscsi-2 -StaticAddress 192.168.0.21 -NoStorage

Add disk to Cluster

Get-ClusterAvailableDisk | Add-ClusterDisk

Add cluster computer account (isci_cluster) rights to create computer objects

Right click OU with computer account-Delegate Control

1.PNG

Object Types-Computer

241.png

1.PNG

Create custom task to delegate

241.png

Only the following objects in the folder-Computer Object-Create selected objects in this folder

241.png

General-Full Control

 

241.png

Adding iSCSI Target cluster role

 

Add-ClusteriSCSITargetServerRole -Storage 'Cluster Disk 1' -StaticAddress 192.168.0.22 -Name 'iscsi_target'

 

iscsi_target is netbios name which is used to access iSCSI clustered storage

 

1.PNG

 

 

 

Scale-Out File Server provide scale-out file shares that are continuously available for file-based server application storage.Scale-out file shares provides the ability to share the same folder from multiple nodes of the same cluster.

Benefits provided by Scale-Out File Server in include:

  • Active-Active file shares   All cluster nodes can accept and serve SMB client requests.
  • Increased bandwidth   The maximum share bandwidth is the total bandwidth of all file server cluster nodes.
  • CHKDSK with zero downtime  A CSV File System (CSVFS) can use CHKDSK without impacting applications with open handles on the file system.
  • Clustered Shared Volume cache    CSVs in Windows Server 2012 introduces support for a Read cache, which can significantly improve performance in certain scenarios, such as in Virtual Desktop Infrastructure (VDI).
  • Simpler management   With Scale-Out File Server, you create the scale-out file servers, and then add the necessary CSVs and file shares. It is no longer necessary to create multiple clustered file servers, each with separate cluster disks.

Preparing storage

As cluster storage i used iSCSI disk.On separate Windows Server i added HDD and installed iSCSI target Server feature:

7.PNG

Then,from server manager i created iSCSI virtual disk

8.PNG

9.PNG

New iSCSI target:

10.PNG

Set storage name

11.PNG

Add-Select IP from drop-down list and enter IP address of server which will be cluster nodes (FS-01 and FS-02 in my case)

12.PNG

Add iSCSI disk to cluster nodes:

On future cluster nodes go to Control Panel-iSCSI Initiator

13.png

 

 

14.PNG

 

Enter IP address of iSCSI target (server with iSCSI virtual disk)

 

15.png

 

16.PNG

Initialize and format disk

Creating Cluster:

FS-01 and FS-02 (servers which we addedd iSCSI disk for) will be cluster members.From any of these two servers add File Server and cluster roles:

Invoke-Command fs-01,fs-02 {Add-WindowsFeature –name File-Services,Failover-Clustering -IncludeManagementTools}

Validate Cluster:

From Cluster Manager click Validate Configuration

1.png

Add nodes:

2.PNG

Run all test

3.PNG

Or use PowerShell equivalent:

Test-Cluster –Node fs-01,fs-02

Creating Cluster

From Cluster Manager click Create Cluster

4.png

Add Cluster members and give cluster name and specify IP (Cluster computer account will be created)

5.PNG

Uncheck Add all eligible storage to the cluster check-box !!!

6.PNG

PowerShell:

New-Cluster –Name ClusterName –Node fs-01,fs-02 -StaticAddress 192.168.0.20 -nostorage

Giving Cluster computer account rights to create computer object:

If we don’t delegate rights to Cluster computer object we won’t be able to add cluster File Server role

Right click OU where Cluster Computer object is creted-Delegate control

23.png

Object Types-Computer

24.PNG

25.PNG

Create custom task to delegate

26.PNG

Only the following objects in the folder-Computer Object-Create selected objects in this folder

Untitled.png

General-Full Control

27.PNG

Add disk to Cluster

From any node right click Disks-Add Disk

Untitled.png

Add storage to a cluster shared volume

A cluster shared volume is used by a failover cluster, and it can be accessed by more than one node at a time.

Right click on disk added in previous step-Add to Cluster Shared Volume

PowerShell:

Add-ClusterSharedVolume  "Cluster Disk 1"

Configure File Server Role:

Right click Roles-Configure Role

19.png

File-Server

20.PNG

Scale-Out File Server

21.PNG

Give it name

22.PNG

PowerShell:

Add-ClusterScaleOutFileServerRole -Name shared_storage -Cluster test_cluster

 

Creating a continuously available file share on the cluster shared volume

 

Right click file server role-Add File Share

 

Untitled.png

 

SMB-Share-Application

 

28.PNG

Select volume

 

Untitled.png

 

Choose name

 

Untitled.png

 

 

Make sure Enable continuous availability is checked

 

29.PNG

 

And set NTFS permissions

 

30.PNG

 

 

 

Setting Hyper-V Replica

Posted: December 24, 2016 in Windows Server

Hyper-V replica feaytures replicates virtual machines from one Hyper-V host server to another. Hyper-V Replica creates a copy of a live virtual machine to a replica offline virtual machine.It’s part of failover strategy.For example,if we have 2 datacenters,we can replicate VM from one data center to another.Replicated VM is in offline state,so in case of disaster recovery VM can be powered on to continue services.This an be used in clustered and non-clustered configuration.

In this example we’ll replicate VM from HyperV-02 to HyperV-01 Hyper-V host:

Enabling replication

First,on HyperV-01 host enable replication from HyperV-02:

On HyperV-01 go to Hyper-V settings

1-1.png

Set Kerberos authentication

1.PNG

PowerShell:

Set-VMReplicationServer -ComputerName hyperv-01 -ReplicationEnabled $true -AllowedAuthenticationType Kerberos -ReplicationAllowedFromAnyServer $false

Because we want to allow replication only from specific server we need to add ReplicationAutorization Entry (trust group is random chosen)

New-VMReplicationAuthorizationEntry -AllowedPrimaryServer hyperv-02.test.com -ReplicaStorageLocation  c:\vm -TrustGroup test_group

Setting firewall:

Rule for Hyper-V replication is turned off by default,we need to enable it:

3.png

Get-NetFirewallRule -displayName ‘Hyper-V Replica HTTP Listener (TCP-In)’ | Enable-NetFirewallRule

On HyperV-02 host (where VM is located)

1.PNG

Set-VMReplicationServer -ComputerName hyperv-02 -ReplicationEnabled $true -AllowedAuthenticationType Kerberos -ReplicationAllowedFromAnyServer $false
New-VMReplicationAuthorizationEntry -AllowedPrimaryServer hyperv-01 -ReplicaStorageLocation c:\vm -TrustGroup test_group

Enabling replication for VM

On HyperV-02 right click VM-Enable Replication:

1-1.png

Enter Hyper-V host where VM will be replicated:

1-1.png

Choose if you wish to compress the data

1-1.png

If VM has more than one disk,it can be excluded from replication:

1-1.png

Set replication frequency

1-1.png

Configure recovery points:

1-1.png

Choose how VM data can be transferred to Replica Server (HyperV-01),over the network,or export it locally and copy it then to target server,and schedule replication

1-1.png

Using PowerShell:

Enable-VMReplication -VMName '2003' -ReplicaServerName 'hyperv-01.test.com' -ReplicaServerPort 80 -AuthenticationType Kerberos -CompressionEnabled $true
Set-VMReplication -VMName '2003' -ReplicaServerName 'hyperv-01.test.com' -ReplicaServerPort 80 -AuthenticationType Kerberos -CompressionEnabled $true -RecoveryHistory 0
Start-VMInitialReplication -VMName '2003'

We can track replication status:

Right click VM-Replication-View Replication Health

4.png

 

 

5

 

Get-VMReplication -VMName '2003' | fl *

 

6.PNG

 

On Hyper-V host open PowerShell as administrator:

Enable-PSRemoting

To allow remote access on public zones, enable firewall rules for CredSSP and WinRM:

Enable-WSManCredSSP -Role server

On workstation computer (from which we need to access Hyper-V host edit hosts file

and add ip addressess of Hyper-V hosts

1.PNG

From CMD (Run as admin) add Hyper-V hosts as trusted hosts:

winrm set winrm/config/client @{TrustedHosts="hyperv-01,hyperv-02"}

 

1.PNG

Add Hyper-V hosts credentials:

cmdkey /add:hyperv-01 /user:test\administrator /pass:Password01
cmdkey /add:hyperv-02 /user:test\administrator /pass:Password01

Add server to Hyper-V manager on workstartion computer (install it first)

1.PNG

Using PowerShell:

# Install only the PowerShell module
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Management-PowerShell
 
# Install the Hyper-V management tool pack (Hyper-V Manager and the Hyper-V PowerShell module)
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Tools-All

1.PNG

1.PNG

1.PNG

Hyper-V live migration moves running virtual machines from one physical server to another with no impact on virtual machine availability to users.

In this example we’ll move server-2016 VM from HyperV-01 to HyperV-02 host

1.png

The following protocols can be used for Live Migration:

Kerberos avoids having to sign in to the server, but requires constrained delegation.

CredSSP  avoids configuring constrained delegation, but requires sign in to the source server

I’ll use Kerberos authentication,so we need to set up delegation.We’ll move VM from HyperV-01 to HyperV-02 and we’ll configure delegation on source (HyperV-01) and delegate rights to destionation Hyper-V host (HyperV-02)

In Active Directory right click on source computer account (from which we’ll move VM-HyperV-01)-Delegation tab-Add

 

2.png

 

In Add services window click Users and Computers

 

3

Add destination account (where VM will be moved to-HyperV-02) and select Microsoft

Virtual System Migration Service

 

4.png

Enabling Live Migration

Right click bn both Hyper-V host-Hyper-V Settings

 

5.png

 

Check enable incoming and outgoing live migrations,optionally specify IP addresses for live migration (these are HyperV-01 and HyperV-02 addresses)

 

6.png

 

Specify protocol and Performance options:

 

6-1.png

 

Moving VM

 

Right click on VM-Move

 

7.png

 

 

 

8.png

 

Specify destination Hyper-V host

 

9.png

 

 

10.png

 

This folder needs to be present on destination Hyper-V host

 

11.png

After clicking Finish VM will be moved to HyperV-02

 

12.png

Enable-WindowsOptionalFeature –Online -FeatureName Microsoft-Hyper-V –All -NoRestart

Creating Virtual Switch

There are 3 types of virtual switch:

External:Gives virtual machines access to a physical network to communicate with servers and clients on an external network,also it communicates connections between Hyper-V VM’s on the same Hyper-V server

Internal:Allows communication between virtual machines on the same Hyper-V server, and between the virtual machines and the management host operating system.

Private:Only allows communication between virtual machines on the same Hyper-V server.

In this exampe we’ll create external switch:

New-VMSwitch -Name External -NetAdapterName (Get-NetAdapter |?{$_.Status -eq "Up" -and $_.NdisPhysicalMedium -eq 14}).Name

Creating Virtual Machine (7 GB,HDD 50 GB)

New-VM -Name 'Hyper-V1' -MemoryStartupBytes 7gb -NewVHDPath 'C:\VM''s\Hyper-V.vhdx' -SwitchName 'external' -NewVHDSizeBytes 50GB -Generation 2

Configure VM’s processor count:

Set-VM -VMName 'Hyper-V1' -ProcessorCount 4

Adding DVD:

get-vm -VMName 'Hyper-V1' | Add-VMDvdDrive
Set-VMDvdDrive -VMName 'Hyper-V1' -Path 'F:\14393.0.160715-1616.RS1_RELEASE_SERVER_EVAL_X64FRE_EN-US.ISO'

Starting VM

Start-VM 'Hyper-V1'

Adding Additional Hard disk

New-VHD -Path 'C:\VM''s\Added.vhdx' -SizeBytes 50GB

In order to locate available Controller location we need to see current VHD properties

4

Add-VMHardDiskDrive -VMName 'Hyper-V1' -Path 'C:\VM''s\Added.vhdx' -ControllerType SCSI -ControllerNumber 0 -ControllerLocation 2

 

If Hyper-V server is located in remote computer we can connect to it by VMConnect.exe

3

But,first,Remote Hyper-V server IP needs to be added to TrustedHosts:

set-item WSMan:\localhost\Client\TrustedHosts -value "192.168.0.42"