Figure 1.4 Choose the edition of Windows Server 2012 that you want to install... If you want a server core deployment, you will have to upgrade to the full GUI version of Windows Server
Trang 2Share this e-book with your peers
Contents
Chapter 3 Migrations 84
Chapter 8 Replication 246
Chapter 10 Networking 293
Trang 3This chapter is designed to get you started quickly with Hyper-V 3.0 It starts with a discussion of the hardware requirements for Hyper-V 3.0 and then explains a basic Hyper-V–deployment followed by an upgrade from Hyper-V 2.0 to Hyper-V 3.0 The chapter concludes with
a demonstration of migrating virtual machines from Hyper-V 2.0 to Hyper-V 3.0
Chapter 1
An Introduction
to Hyper-V 3.0
Trang 4• A monitor and video card with a minimum display resolution of 800 x 600
• Keyboard and mouse (or other compatible pointing device)
• Internet accessBecause Hyper-V is designed to use the server’s hardware to host a number
of virtual machines, the minimum system requirements are not suitable for Hyper-V Specifically, you will need more memory and hard disk space, and it’s advisable to have a server with multiple sockets and/or multiple CPU cores The servers used in the development of this book were equipped with the following:
• An 8-core, 64-bit CPU
• 32 GB of RAM
• A 500-GB hard drive used to store the host operating system
• Four 1-TB hard drives configured as a RAID 5 array
In addition to the hardware requirements listed above, the CPU must support hardware-level virtualization It is worth noting that virtualization has been disabled by default on many servers, so you may need to enable virtualization through the system BIOS, as shown in Figure 1.1 If your server’s BIOS contains
a setting for Data Execution Prevention (DEP), you will need to enable that setting as well
Trang 5Figure 1.1
You may need to manually enable virtualization in the server’s BIOS.
Installing Windows Server 2012 and Hyper-V 3.0
Setting up a clean installation of Windows Server 2012 and Hyper-V 3.0 is relatively simple and straightforward First, install Windows Server 2012 by completing these steps:
1 Boot your server from the Windows Server 2012 installation media
2 When the Windows Server 2012 splash screen launches, verify that
the language, time and currency format, and keyboard or input methods
are correct (Figure 1.2)
Figure 1.2
Verify your installation preferences.
Trang 63 Click Next.
4 Click Install Now (Figure 1.3).
Figure 1.3
Click Install Now.
5 Choose the operating system that you want to install (Figure 1.4) It is worth noting that a default Windows Server 2012 does not include the GUI If you want to use the GUI then do not choose the Server Core option Although Server Core is Microsoft’s preferred method for deploying Windows Server 2012, it is easier to manage Hyper-V through a GUI Therefore, the instructions found throughout this book will assume that you are using the GUI If you are interested in Server Core deployments, see Chapter 5 for a discussion about managing Hyper-V through Windows PowerShell
Figure 1.4
Choose the edition of Windows Server 2012 that you want to install.
Trang 76 Accept the license agreement and click Next (Figure 1.5).
Figure 1.5
You must accept Microsoft’s license agreement.
7 When prompted for the type of installation you want to perform, choose
the option for Custom: Install Windows Only (advanced) (Figure 1.6).
Figure 1.6
Choose the option to perform a custom installation.
8 Choose the volume on which you want to install Windows and click Next
(Figure 1.7)
Trang 8Figure 1.7
Select the drive or volume on which you want to install Windows Server 2012.
9 Setup will now begin the installation process (Figure 1.8) After the Windows installation completes , you must work through a separate process to install Hyper-V
1 Open the Server Manager if it is not already open
2 Choose the Add Roles and Features command from the Manage menu
(Figure 1.9)
Trang 9Figure 1.9
Choose the Add Roles and Features command.
3 When the Add Roles and Features Wizard launches, click Next to bypass
the wizard’s Welcome screen
Trang 10Figure 1.11
Make sure that your local server is selected.
8 Select Hyper-V from the list of server roles (Figure 1.12).
Figure 1.12
Select the Hyper-V role.
9 If you are prompted to install additional features, click the Add
Features button.
10 Click Next.
Trang 1111 When the wizard displays the list of available features, click Next.
12 Click Next on the Hyper-V introductory screen.
13 Select the network adapters that you want to make available to your virtual machines Be sure to reserve at least one network adapter for host management traffic (Figure 1.13)
discussed in Chapter 3, so for now just click Next to accept the defaults.
16 When prompted, click Next to accept the default stores.
17 When the Confirmation screen is displayed, click the Install button.
Post deployment tasks
After the installation process completes, you may need to perform a number of post-deployment tasks, which might include:
• Configure the host’s IP address
• Rename the host
• Join the host to a domain
The sections that follow will walk you through performing each of these tasks
Trang 12Configure the host’s IP address
In most cases, Hyper-V host servers need to have at least one NIC that is dedicated to hosting management traffic As a best practice, you should assign
a static IP address to this NIC You can assign an IP address to the server’s management NIC as follows:
1 Move the mouse to the lower left corner of the screen and right click
Choose the Control Panel option from the right-click menu.
2 When the Control Panel appears, click on Network and Internet.
3 Click on Network and Sharing Center.
4 Click on the Change Adapter Settings link.
5 Right click on the icon representing your management NIC and choose
the Properties command from the shortcut menu.
6 Assuming that IPv4 is being used, select the Internet Protocol Version 4
(TCP/IPv4) option and click the Properties button (Figure 1.14).
7 Enter the IP address that you want to assign to the NIC and click OK
(Figure 1.15)
Figure 1.14
Select Internet Protocol Version 4 (TCP/IPv4) and click the Properties button.
Trang 13Figure 1.15
Provision your management NIC with a static IP address and click OK.
Rename the host
Windows Server 2012 automatically assigns a unique host name to each server, but it is generally advisable to assign a more meaningful name to each Hyper-V host Doing so will make the host management process easier To assign a new name to your Hyper-V host server, follow these steps:
1 Move the mouse to the lower left corner of the screen and right click
Choose the System option from the right-click menu.
2 When the System properties sheet appears, click on the Change Settings
link (Figure 1.16)
Trang 14Figure 1.16
Click the Change Settings link.
3 Verify that the Computer Name tab is selected and then click the Change
button (Figure 1.17)
Figure 1.17
Click the Change button.
Trang 154 Enter a new name for the server and click OK (Figure 1.18).
Figure 1.18
Enter a new computer name and click OK.
5 Click OK to acknowledge the message indicating that you must restart
your computer to apply the new name
Trang 16Join the host to a domain
The process of joining a Windows Server 2012 host to a domain is very similar
to that used in joining a Windows Server 2008 R2 host to a domain To join
a domain, follow these steps:
1 From the Metro interface, click the Desktop tile.
2 Move your mouse to the lower left corner of the screen and right-click on
the Start tile.
3 Click on the System option on the right-click menu.
4 When the System dialog box appears, click on the Change Settings link
8 When prompted, enter a set of administrative credentials for the domain.
9 Click OK to clear the message indicating that the computer has been
joined to a domain
10 Reboot the server (Figure 1.19)
Performing an in-place upgrade from Hyper-V 2.0
If your organization is currently running Hyper-V 2.0, it is usually possible to perform an in-place upgrade to Hyper-V 3.0 In preparation for an upgrading
a standalone Hyper-V 2.0 server, you must shut down any virtual machines that are currently running To complete the upgrade, follow these steps:
1 Shut down any virtual machines that are running on the server to be upgraded If any virtual machines are left running, the Compatibility Report will prevent the upgrade from continuing (Figure 1.20)
Trang 17Figure 1.20
You must shut down the virtual machines prior to beginning the upgrade.
2 With Windows Server 2008 R2 still running, insert your Windows Server
2012 installation media and run the Setup program.
3 When the Windows Server 2012 splash screen appears, click Install Now
(Figure 1.21)
Figure 1.21
Click the Install Now button.
4 When prompted, click on the option to go online to install updates (Figure 1.22)
Trang 18Figure 1.22
You should go online to get the latest updates.
5 Enter your product key and click Next.
6 Select whether you want to perform a server core deployment or a server deployment that includes the GUI (Figure 1.23) It is worth noting that Windows Server 2012 is designed to perform a server core deployment by default However, you cannot perform an in-place upgrade of a full Windows Server deployment (with a GUI) to a server core deployment If you want a server core deployment, you will have to upgrade to the full GUI version of Windows Server 2012 and then uninstall the GUI later The instructions provided in this book assume that you will
full-be working with a full GUI-based installation If you are interested in using Server Core, see Chapter 5 for a discussion of how to manage Hyper-V from PowerShell
Figure 1.23
Choose the edition of Windows Server 2012 that you want to install.
Trang 197 Click Next.
8 When prompted, accept the license agreement and click Next
(Figure 1.24)
Figure 1.24
You must accept Microsoft’s license agreement.
9 Choose the option to Upgrade: Install Windows and keep files, settings,
and applications (Figure 1.25).
Figure 1.25
Choose the option to upgrade the existing operating system.
10 Take a moment to review the Compatibility Report, which informs you
of issues you need to address prior to moving forward with the upgrade
(Figure 1.26) When you are finished, click Next.
Trang 20Figure 1.26
Take a moment to read the compatibility report.
11 At this point, Windows will be installed The remainder of the upgrade process is automated
Migrating virtual machines from Hyper-V 2.0 to Hyper-V 3.0
One of the big disadvantages to performing an in-place upgrade is that it can cause virtual machines to be down for a significant amount of time One way
to reduce the amount of time during which virtual machines are unavailable
is to perform a migration rather than an upgrade A migration involves deploying Hyper-V 3.0 onto new hardware while your existing hardware continues to run Hyper-V 2.0 Once the deployment is complete, you can migrate the individual virtual machines from the Hyper-V 2.0 deployment to the Hyper-V 3.0 deployment
Exporting the virtual machines
The first step in migrating virtual machines from Hyper-V 2 to Hyper-V 3 is to export the virtual machines to either a network share or to removable media
To complete the export process, follow these steps:
1 Open the Hyper-V Manager on the Hyper-V 2.0 Server.
2 Select the virtual machines that you want to export (Figure 1.27)
Trang 21Figure 1.27
Select the virtual machines that you wish to export.
3 Click on the Export link.
4 Specify a path to write the exported content (Figure 1.28) Be sure to choose a location with plenty of free storage space
Figure 1.28
Enter an export path and click the Export button.
5 Click Export.
You can monitor the progress of the export by scrolling the Hyper-V Manager
to view the virtual machine Status (Figure 1.29)
Trang 22Figure 1.29
You can monitor the export process through the Hyper-V Manager.
Importing virtual machines
Importing virtual machines into Hyper-V 3.0 is a relatively easy and straightforward process You can import one or more virtual machines
as follows:
1 Open the Hyper-V Manager.
2 Right-click on the name of the Hyper-V host and select the Import Virtual
Machine command from the right-click menu (Figure 1.30).
Figure 1.30
Right click-on your the server and select the Import Virtual Machine command from the right-click menu.
3 When the Import Virtual Machine wizard launches, click Next to bypass
the wizard’s Welcome screen
4 Click the Browse button.
Trang 235 Navigate to the folder containing the virtual machine that you want to import and click the Select Folder button.
6 Choose the virtual machine that you want to import (Figure 1.31)
usually best to choose the option to Copy the Virtual Machine (Create
a New Unique ID) This allows the exported virtual machine to be
re-imported later should the need ever arise
Trang 24the defaults Click Next.
11 The wizard will now ask where you want to store the imported Virtual
Hard Disks Select a folder on an appropriate volume and click Next.
12 Verify the summary information screen and click Finish (Figure 1.33).
Trang 25Figure 1.33
The import process begins when you click Finish.
The import process can take a considerable amount of time to complete, depending upon the size of the virtual machine and the speed of the hardware When the import process finishes, you should see the newly imported virtual machine within the Hyper-V Manager
Before you power-up the newly imported virtual machine, you need to connect the virtual machine to a virtual switch To do so, right click on the virtual
machine and choose the Settings command from the right-click menu When the Settings page appears, click on the Network Adapter option and then
connect the virtual machine to the appropriate virtual switch (Figure 1.34)
When you have finished, click OK.
Trang 26Figure 1.34
You must connect your virtual machine to a virtual switch.
This completes the process of importing a virtual machine Previous versions
of Hyper-V required you to re-enter the IP address configuration for each virtual network adapter However, Hyper-V 3.0 preserves the virtual machine’s
IP address configuration The only change that you might need to make to the virtual machine is to install an updated version of the Hyper-V Integration Services
What about clusters?
This chapter has discussed clean Hyper-V installations as well as the process for upgrading a Hyper-V 2.0 server to Hyper-V 3.0 Although these techniques are certainly valid, organizations that are currently running Hyper-V are often using a clustered environment
The process of building a Hyper-V cluster is discussed in detail in Chapter 2 This section explains what is involved in upgrading a Hyper-V 2.0 cluster to Hyper-V 3.0—a process that is not entirely intuitive
Microsoft’s preferred method for performing a cluster upgrade involves building
an entirely new cluster The basic idea is to create a cluster out of servers that are running Windows Server 2012 If you lack the budget to build a completely new
Trang 27cluster, you can start small by building the new cluster with a minimum number
of cluster nodes and using low-end hardware if necessary After the migration process is complete, you can always install Windows Server 2012 onto your existing cluster hardware, join those servers to the new cluster and then remove the temporary, low-end servers from the cluster Don’t worry too much about exceeding the maximum cluster size during the migration process, because Windows Server 2012 allows up to 63 cluster nodes
As you probably know, Hyper-V 2.0 clusters depend on the use of Cluster Shared Volumes When you build the new Hyper-V 3.0 cluster, you must attach the cluster nodes to the existing cluster shared volume (see Chapter 2 for details)
At this point, both the Hyper-V 2.0 cluster and the Hyper-V 3.0 cluster should be tied into the same Cluster Shared Volume
Once the Hyper-V 3.0 cluster is in place, verify that the Hyper-V 2.0 cluster is still functional and that the virtual machines are still running (there is no reason why they shouldn’t be, because the cluster has not been modified) Now, open the Failover Cluster Manager on one of your Windows Server 2012 servers and follow these steps:
1 Right-click on the cluster name and choose the More Actions | Migrate
Roles commands from the right-click menus (Figure 1.35).
Figure 1.35
Choose the Migrate Roles option.
2 When the Migrate a Cluster Wizard launches, click Next to bypass
the wizards’ Welcome screen
3 When prompted, enter the name of the old cluster from which you plan to migrate the virtual machines (Figure 1.36)
Trang 28Figure 1.36
Enter the name of your Hyper-V 2.0 cluster.
4 Select the virtual machines that you plan to migrate and click Next
(Figure 1.37)
Figure 1.37
Choose the virtual machines that you want to migrate.
Trang 295 Choose the Virtual Network Switch that the virtual machines should use after they have been migrated to the new cluster and click Next.
6 The next screen provides an analysis of the migration You can click
the View Report button to see the full Failover Cluster Pre-Migration
Report It is worth noting that the report indicates that the cluster group
and the available storage cannot be migrated This is perfectly normal and acceptable
7 Close the report and click Next.
8 Take a moment to verify the information displayed on the Confirmation screen and click Next.
9 When the migration completes, click Finish.
Please keep in mind that Windows Server 2012 does not perform a live migration
of the virtual machines When the migration completes, the virtual machines are still running on the Hyper-V 2.0 cluster, so there are a couple of things that you need to do to complete the process
First, shut down the virtual machines on the Hyper-V 2.0 server Second, disconnect the Hyper-V 2.0 cluster nodes from the shared storage If you fail to
do this, virtual machine corruption can occur Finally, start the virtual machines
on your new cluster Once the virtual machines are up and running, it is safe to destroy your Hyper-V 2.0 cluster and re-provision the host servers for use in the new cluster
Share this e-book with your peers
Trang 30Chapter 2 is designed to familiarize you with your options for Hyper-V clustering Hyper-V 3.0 allows you to build
a cluster with or without shared storage, and this chapter walks you through both methods In addition, you will learn how to provision storage using a new Windows Server 2012 feature called Windows Storage Spaces.
Chapter 2
Failover Clustering
Trang 31Perhaps the most important concept to understand with regard to server virtualization is that of clustering The reason for this is simple: Server virtualization places an increased importance on server hardware In a traditional physical datacenter the failure of a single server is typically regarded as
an inconvenience, but is rarely catastrophic In a virtual datacenter, however, this may not be the case Each physical server hosts multiple virtual machines Therefore, if a physical server fails then all of the virtual machines residing on that server will also fail Hence, the failure of a single physical host can cause a major outage The only way to protect against this type of failure is through the use of failover clustering
Failover clustering spreads a virtualized workload across multiple physical hosts That way if a host server fails, the virtual machines can fail over to a different host server within the cluster and remain online in spite of the failure
Failover clustering is not new to Hyper-V 3.0, but Microsoft has made significant improvements to failover clustering Many of these improvements are related
to scalability The table below compares a Hyper-V 2.0 cluster to a Hyper-V 3.0 cluster in terms of scalability
The maximum number of virtual machines per host that can be powered on at any given time
Maximum number of virtual machines in
Maximum number of
Maximum RAM per
Another major improvement that Microsoft has made with regard to failover clustering is that they have changed the storage requirements Prior to Hyper-V 3.0, a Hyper-V cluster depended on the use of a Cluster Shared Volume
A Cluster Shared Volume is a shared storage volume that physically contains all
of the virtual machine components Because the storage is shared, it is physically accessible to all of the cluster nodes You can see an example of shared storage architecture in Figure 2.1
Trang 32Figure 2.1
Previous versions of Hyper-V required failover clusters to make use of shared storage.
In Hyper-V 3.0, shared storage is no longer required for failover clustering
A failover cluster can be built without the need for a Cluster Shared Volume
In those types of clusters, the virtual machines can reside on local direct attached storage or they can even reside on certain types of file servers
The fact that you can create failover clusters without a Cluster Shared Volume is good news for smaller organizations because the cost of shared storage often puts clustered virtualization hosts financially out of reach Even so, Microsoft recommends that Hyper-V 3.0 failover clusters make use of failover clusters whenever possible This chapter will demonstrate the process of building failover clusters both with and without shared storage
Cluster planning
Before you begin constructing a failover cluster you will need to do some planning Obviously you will need to decide whether the cluster will use shared storage, you’ll need to take into account a number of other considerations, including:
• Domain membership — Domain membership isn’t an absolute
requirement for cluster nodes, but the configuration process is a lot easier
if all of the cluster nodes are members of a common Active Directory domain Domain membership allows Kerberos authentication to be used This chapter will assume that all cluster nodes have been joined
to a common Active Directory domain
• Node names — Just as the cluster requires a cluster name, each cluster
node requires a unique computer name Although Windows Server 2012 assigns computer names automatically, it is highly recommended that you assign computer names that are more descriptive Doing so makes it easier
to figure out which node you are working on The cluster nodes used in the examples in this chapter will be named Lab1, Lab2 and Lab3
Trang 33• Cluster name — The configuration process requires that a unique name
be assigned to the cluster The name you choose should be different from any of the computer names that are used within your Active Directory
• Cluster node hardware — Another important consideration is the cluster
nodes themselves The nodes do not have to use identical hardware, but they should all use the same CPU architecture and ideally they should be equipped with comparable amounts of memory
• Number of nodes — You also need to decide how many nodes to use
in your cluster In this chapter you will be building a Majority Node Set Cluster It is best to use an odd number of cluster nodes whenever possible because a Majority Node Set Cluster requires half of the nodes plus one
to remain online during a failure in order for the cluster to retain quorum
It is technically possible to build a failover cluster out of two cluster nodes (plus a file share witness), but it's recommended that you always use at least three cluster nodes Your cluster can contain as many as 63 nodes
Of course, most clusters use far fewer than 63 nodes, and you always have the option of adding additional cluster nodes later until the maximum number of nodes has been reached
• Network adapters — Hyper-V is very flexible in terms of the network
adapter requirements for cluster nodes However, it is generally recommended that each cluster node have a minimum of three network adapters You should reserve one adapter should be reserved for
management traffic and another adapter for cluster traffic The third (and any additional adapters) are used for virtual machine traffic
• Node IP addresses — As a best practice, you should assign a static IP
address to each cluster node’s management NIC However, you will also need to decide how you want to handle IP address assignment for the other NICs
• Cluster IP address — In addition to the IP addresses assigned to physical
NICs you must assign a static IP address to the cluster This IP address
is used to communicate with the cluster as a whole rather than with
an individual cluster node
Building a failover cluster without shared storage
As previously mentioned, it is possible to build a failover cluster without using shared storage This part of the chapter will walk you through the process You will be building a Majority Node Set cluster consisting of three cluster nodes Keep in mind, however, that if it is within your budget, you should use shared storage whenever possible, as Microsoft recommends
This section assumes that you have installed Windows Server 2012 onto each cluster node, joined the cluster nodes to an Active Directory domain, and provisioned each node with an appropriate computer name and the necessary IP addresses
Trang 34Installing the failover clustering feature
The first step in the configuration process is to install the Failover Clustering feature onto each cluster node You can accomplish this task by following these steps:
1 Open the Server Manager
2 Choose the Add Roles and Features option from the Manage menu.
3 When the Add Roles and Features Wizard starts, click Next to bypass
the welcome screen
4 Choose the Role-Based or Feature-Based Installation option and click
Next.
5 Verify that the correct server is selectedand click Next (Figure 2.2).
Figure 2.2
You must install the Failover Clustering feature onto each of the cluster nodes.
6 When the wizard displays the list of server roles, click Next.
7 Select Failover Clustering from the list of features (Figure 2.3) If the wizard prompts you to install additional features, click the Add Features button.
Trang 35Figure 2.3
Select the Failover Clustering feature.
8 Click Next.
9 Click Install.
10 When the installation process completes, click Close.
Building a Majority Node Set Cluster
Now that the Failover Clustering Service has been installed, the next step in the process is to build the failover cluster The steps listed in this section only need to be performed on one of the cluster nodes To create the failover cluster, follow these steps:
1 Open the Server Manager.
2 Choose the Failover Cluster Manager option from the Tools menu.
3 When the Failover Cluster Manager opens, click on the Create Cluster link, found in the Actions pane (Figure 2.4) Windows will launch the Create
Cluster Wizard.
Trang 36Figure 2.4
Click on the Create Cluster link.
4 Click Next to bypass the wizard’s Welcome screen.
5 Specify the names of the servers that you want to include in the cluster (Figure 2.5)
Figure 2.5
You should specify all of the nodes that you want to include in the cluster.
Trang 376 Click Next.
7 You should now see a message indicating that the cluster has not yet been
validated Choose the option to run the validation tests and click Next (Figure 2.6) Windows will launch the Validate a Cluster Wizard.
Figure 2.6
You must validate the cluster before you can create it.
8 Click Next to bypass the wizard’s Welcome screen.
9 Choose the Run All Tests (Recommended) option and click Next.
10 Click Next to begin the validation tests.
11 When the validation tests complete, take a moment to view the report
and review any errors or warnings (Figure 2.7) Click Finish
Trang 38Figure 2.7
Review the validation report and check for any errors or warnings.
12 When prompted, enter a name for the cluster and assign an IP address
to the cluster (Figure 2.8) The name and IP address that you use should be unique and will be used to identify the cluster as a whole
Figure 2.8
You must assign a unique name and static IP address to the cluster.
Trang 3913 Click Next.
14 Take a moment to verify the information presented on the confirmation
screen and click Next.
15 You should see a message indicating that the cluster was created
successfully Click Finish to close the wizard.
Installing the Hyper-V role
The next step in the process is to install the Hyper-V role This role must be installed onto each of the cluster nodes To complete this process, follow these steps:
1 Open the Server Manager.
2 Choose the Add Roles and Features command from the Manage menu.
3 When the Add Roles and Features wizard appears, click Next to bypass
the wizard’s Welcome screen
4 Make sure that the Role-Based or Feature-Based Installation option is selected and click Next.
5 Select the server on which you want to deploy the Hyper-V role and click
Next (Figure 2.9).
Figure 2.9
Choose the server on which you want to deploy the Hyper-V role.
Trang 406 Select the Hyper-V option from the list of roles (Figure 2.10).
Figure 2.10
Select the Hyper-V role and click Next.
7 If you are prompted to add additional features, click the Add Features