Hyper-V Cluster

最後更新: 2017-02-23

介紹

 

Microsoft Failover Clustering is always in an active/passive configuration.
This means that any single role can only operate on a single cluster node at any given time.
A cluster can operate multiple roles simultaneously, however.
Depending on the role type, it may be possible for roles to operate independently on separate hosts.
As this specifically applies to Hyper-V, an individual virtual machine is considered a role,
not the entire Hyper-V service.
Therefore, a single virtual machine can only run on one Hyper-V host at any given time,
but each host can run multiple virtual machines simultaneously.

If a host crashes, all of its virtual machines will also crash, but they will be automatically restarted on another cluster host.

Because a virtual machine cannot run on two hosts simultaneously, Hyper-V virtual machines are not considered fault tolerant.

 


Hardware Requirements

 

Shared Storage

 * SAS enclosures are supported as shared storage in a failover cluster via Storage Spaces subsystem in Windows Server 2012

 * SMB 3.0 file shares as shared storage

 

Networks Infrastructure

 

 * a public network(clients), a separate network(heartbeat), additional networks for specific storage options or for redundancy.
 * identical communication settings: Speed, Duplex Mode, Flow Control
 * All servers in the cluster must be in the same Active Directory domain.
 * The servers in the cluster must be using Domain Name System (DNS) for name resolution.

 


Step

 

Step 0: Connect both physical computers to the networks and storage (on both physical computers)

 

Step 1: Install Hyper-V and Failover Clustering (on both physical computers)

In Server Manager, on the Manage menu, click Add Roles and Features. 

On the Select installation type page, select Role-based or feature-based installation and then click Next.

On the Select server roles page, select Hyper-V.

 

Step 2: Create a virtual switch (on both physical computers)

Open Hyper-V Manager.

From the Actions menu, click Virtual Switch Manager.

Under Create virtual switch, select External.

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

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

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

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

 

Step 3: Install Failover Clustering (on both physical computers)

Server Manager -> Add Roles and Features -> Role-based or feature-based installation

-> Select server roles -> Select features -> Failover Clustering

 

Step 4: Validate the cluster configuration

# runs all applicable cluster validation tests on the local cluster.

PS C:\> Test-Cluster

# tests on the nodes named node1 and node2.

Test-Cluster -Node node1,node2

# lists the names of all tests

PS C:\> Test-Cluster -List

# runs the storage validation tests on the nodes named node1 and node2.

Test-Cluster -Node node1,node2 -Include Storage

# runs all validation tests except the Inventory tests

PS C:\> Test-Cluster -Node node1,node2 -Ignore Inventory

 

Step 5: Create the cluster

CLI

New-Cluster -Name Contoso-FC1 -Node Contoso-N1,Contoso-N2

# If you choose not to add all eligible storage to the cluster, you can add specific disks after the cluster is created:

New-Cluster -Name Contoso-FC1 -Node Contoso-N1,Contoso-N2 –StaticAddress 10.0.0.14  -NoStorage

# NetBIOS name to be used as the cluster name.
# If you do not want the Active Directory object for the cluster to be placed in the same Organizational Unit (OU) as the servers,
# the specific OU can be designated by specifying the full distinguished name like screen shot below:

New-Cluster -Name CN=Contoso-FC1,OU=Clusters,DC=Contoso,DC=local -Node Contoso-N1,Contoso-N2

 * OU 要事前建立

GUI

 

Step 6: Add a disk as CSV (Cluster Shared Volumes) to store virtual machine data

CSV can enhance the availability and manageability of virtual machines by enabling multiple nodes to concurrently access a single shared storage volume.

support live migration of a Hyper-V virtual machine between nodes in a failover cluster.

Failover Cluster Manager:

expand Storage -> click Disks

Select one or more disks that are assigned to Available Storage

right-click the selection, click "Add to Cluster Shared Volumes"

CMD:

Get-ClusterAvailableDisk | Add-ClusterDisk
Add-ClusterSharedVolume –Name "Cluster Disk 1"

Cache:

  * In Windows Server 2012 R2, the CSV cache is enabled by default.
  * In Windows Server 2012 R2, you can allocate up to 80%.

# Default 0, Unit: MB
(Get-Cluster).BlockCacheSize = 512

Backup:

CSV backups can use application-consistent and crash-consistent Volume Shadow Copy Service (VSS) snapshots.

 

Step 7: Create a highly available virtual machine

 * specify the CSV volume as the location of both the virtual machine and the virtual hard disk.

1. In Failover Cluster Manager

2. Roles -> Actions pane -> click "Virtual Machines" -> click "New Virtual Machine"

3. Click "Store the virtual machine in a different location", Browse CSV Location

4. On the Configure Networking page specify the virtual switch

 

Step 8: Install the guest operating system on the virtual machine

如果不是 Server 2012 R2 VM 安裝在 Server 2012 R2 Hyper-V host

那就要在 VM 安裝 Hyper-V integration services

 

Step 9: Test a planned failover

 * 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.

Failover Cluster Manager:

select "clustered virtual machine" > right-click  > Move > Live Migration > Select Node

Command:

Move-ClusterVirtualMachineRole -Name "FailoverTest" –Node ContosoFCNode2

 

Step 10: Test an unplanned failover

# 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:

Select "Node" > Select "all" of the clustered roles on the node, except VM "FailoverTest"

# Failover Cluster Manager:

Right-click Nodes ->  More Actions -> click Stop Cluster Service.

# CMD:

Stop-ClusterNode –Name ContosoFCNode2

 

Step 11: Modify the settings of a virtual machine

    * recommend that you use the Failover Clustering tools to access the virtual machine settings.

    * 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.

 

Step 12: Remove a virtual machine from a cluster

To remove a clustered virtual machine from a cluster and retain the virtual machine

    1. to take the virtual machine offline.
        a) Failover Cluster Manager
        b) right-click "FailoverTest"
        c) More Actions, and then click Stop Role

    2. export the virtual machine
        a) Hyper-V Manager
        b) "FailoverTest" is selected
        a) Under Actions, click Export.

    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.

 


integration services

 

 * Window 與 Linux 係有不同的 iso

Install or upgrade integration services

Hyper-V includes a software package for supported guest operating systems
that improves integration between the physical computer and the virtual machine.

To install integration services

1. Hyper-V Manager
2. Right-click the name of the virtual machine and click Connect
3. Insert Integration Services Setup Disk.

 


Enable Replication

 

New to Windows Server 2012, Hyper-V Replica is an asynchronous, virtual machine replication technology designed for business continuity and disaster recovery.

Configurations for the Hyper-V Replica server and storage hardware at each site do not have to be identical. Domain membership is also not required.

You need to use certificate-based authentication if you want transmitted data to be encrypted. Use an X.509 v3 certificate to support mutual authentication with certificates. (Port: 443)

不加密都得 (Port: 80)

Hyper-V Replica Failover Operations

Hyper-V Replica is designed to help both planned (scheduled events) and unplanned (disaster recovery) failover situations. Hyper-V Replica allows for fail over to a protected virtual machine on the Replica server at any
time. There are three main options you need to understand for failover operations.

1. Planned Failover to a Replica Server

There are several prerequisites when you perform a planned failover. Your virtual machine must not be running, and your server running Hyper-V at the primary site must be enabled to receive replication traffic from the Replica
server.

2. Test Failover to a Replica Server

You can conduct a test failover operation at any time without interrupting ongoing replication.
This process creates and starts a virtual machine with the name “<virtual machine name> – Test”.

3. Unplanned Failover to a Replica Server

 


Node Drain

 

Bringing an individual node down for planned maintenance is a common administrative task, to for example install a Service Pack or hardware upgrades.

Using Node Drain you can automate moving the Roles (workloads) off of a cluster node. Think of Node Drain is to as an enhanced, workload aware Node Pause.

“Do Not Drain Roles”, then it would simply “PAUSE” the node

The cluster node is put in a PAUSED state, which prevents other workloads hosted on other nodes from moving to the node.

When a node is drained, the cluster will remember the workload(s) that were moved off of the node. When resuming the node after maintenance, you have the option of moving back all the workload(s) to the cluster node.  This will restore the cluster back to the original state it was in before the maintenance.

 


Add VM to Cluster

 

"Failover Cluster Manager"

> right-click on "Roles" Then we select "Configure Role"

>  select "Virtual Machine"

 


evict

 

Shut down cluster service on the node to be evicted before actually evicting it.

Then evict.

Run cluster validation wizard after whole process is done.

Once the node is evicted and quorum settings are changed, it should be safe to disconnect iscsi targets.

 


Add Hyper-V VM to Failover Cluster

 

VM stored on the same LUN can be added to a cluster only if all of the virtual machine resources are in the same storage resource group.

Step(s2012)

1. Copy VM(Folder) to C:\ClusterStorage\Volume2\Hyper-V

2. Import it to node by "Hyper-V Manager"

3. Add it to Cluster

a) Start Failover Cluster Manager

b) Expand the cluster Roles

c) Select the Configure Role... action

d) In the Select Role dialog box, select Virtual Machine as the type and click Next

e) Select VM you want to make highly available and click Next.

f) Click Next to the confirmation. Click Finish to the report, which should show Success for all.

 


DOC

https://technet.microsoft.com/en-us/library/jj863389(v=ws.11).aspx
http://www.altaro.com/hyper-v/failover-cluster-manager/
http://www.lijyyh.com/2012/12/hyper-v-setup-hyper-v-failover-cluster.html
https://blogs.technet.microsoft.com/keithmayer/2012/12/12/step-by-step-b...

 

 

 

Creative Commons license icon Creative Commons license icon