www.apress.com

11/30/16

Building a Home Lab for AlwaysOn

By Peter Carter

Building a cluster to run SQL Server, and other associated services, can be a daunting task. Luckily, in my new book, SQL Server AlwaysOn Revealed 2nd Edition, I walk through each step of this process. The book has been updated for Windows Server 2016, SQL Server 2016 and includes all-new chapters, which focus on on-going monitoring and maintenance.

Prior to building a cluster, you will of course need an infrastructure. When you are at work, in your role as a DBA, this is relatively straight forward. You will request servers, IP Addresses and SAN storage from your infrastructure teams. If you wish to build out a home lab environment, for learning or testing purposes, however, then setting-up the required infrastructure may seem like mission impossible. Therefore, in this article, I will discuss creating a virtual environment, on your laptop or desktop PC, that will then be able to use to follow the examples in SQL Server AlwaysOn Revealed 2nd Edition.

The first thing to discuss, is the scenario that we plan to model. To do this, let’s think about the end requirements. Within the book, we will create a two-node AlwaysOn Failover Clustered Instance, within a single site. Later in the book, we will build an AlwaysOn Availability Group solution, which will consist of a cluster that spans two data centers. We will use the two nodes that we have already built, in the Primary data center and a single node in a secondary data center.

This means that we will need three virtual machines, for the cluster nodes, but there are yet additional virtual machines that will be required. Firstly, we will need a server to act as a Domain Controller. Whilst it is possible in Windows Server 2016 to build a cluster that is not dependent on a domain, in this configuration, SQL Server only supports the use of Availability Groups, not failover clustered instances.

We will also need a server which will act as an iSCSI target. Because we do not have access to a SAN, we will use this to create the storage that will be shared between the cluster nodes. Because we are replicating a scenario where one of the nodes is in a different data center, we will also need to be able to route the traffic between subnets. Therefore, an additional virtual machine will be required, to act as a virtual router.

In total, we will need six virtual machines. Five of these machines will run Windows Server 2016 and support three cluster nodes, a Domain Controller and an iSCSI target. The sixth machine will be running the VyOS operating system and will act as the virtual router.
Because so many Virtual Machines are required, then you will need to use quite a powerful laptop, or desktop PC. The absolute minimum amount of RAM that you can get away with is 8GB, and I would strongly recommend using a machine with 16GB, if possible.

For the hypervisor, I recommend VMware Workstation Player. This product is free for non-commercial use. For Windows Server, you can use an MSDN license, or if you are evaluating the operating system, then you may use the evaluation license. If you are unsure, then check with your licensing manager or compliance officer. VyOS is an open source operating system, which is based on the Debian 6 distribution of Linux.

VMware Workstation Player can be downloaded from www.vmware.com and installing it is a simple matter of running the executable that you have downloaded and stepping through the wizard.

Next, we will download the VyOS virtual appliance.  You should select the iso that matches your base operating system.

Once downloaded, we will use VMWare Workstation Player to create a virtual machine, which will run the operating system. When creating the Virtual Machine, create 2 NICs, configured on different virtual networks. This will allow the router to pass data between the primary and DR site subnets. Point the virtual DVD to the .iso that you downloaded and installation can start automatically.

A full user guide, on the installation and configuration of the VyOS operating system can be found at wiki.vyos.net This user guide will walk you through the process of building the operating system, provide you with a quick start guide for basic configuration and also full details of how to implement more complex requirements.

Now that you have a router in place, you will need a domain controller. If you are planning to use the evaluation version, this can be downloaded from Microsoft.

Create a virtual machine, to run the Windows Server 2016 operating system, and configure the NIC to use the virtual network that represents your primary site. VMware’s Easy Installation will ask you to enter some information up front, and then perform the complete installation, unattended.

For our lab environment, the domain controller will also provide DNS, so configure the preferred DNS Server as the domain controller itself. The subnet mask will be populated automatically. You should also take the time to change the computer name, to a meaningful name, as opposed to the GUID based name that will have automatically been assigned.

We can now configure the virtual machine as a domain controller, by installing the AD DS role from server manager, and then running through the Active Directory Domain Services Configuration wizard, which is accessible from Server Manager.

To build a file server, use the same steps that you used to build the Domain Controller. Remember to change the NIC configuration, so that it is on the virtual network that is simulating your primary site. You will also need to add a iSCSI hard disk, for each disk that we want to be shared between the nodes.

Once the server is built, your first configuration step will be to configure the networking, within the VM. To this this, follow the same steps as when configuring the domain controller, configuring a static IP Address for the file server, specify the default gateway as the virtual router and the preferred DNS server as the domain controller.

You will now be able to join the server to the domain. At the same time, change the computer name to a recognizable, meaningful one.

You will then be ready to begin the configuration of the iSCSI target. To begin this process, use the Add Roles and Features option in Server Manager, to install the File and iSCSI Services role and the iSCSI Target Providers role.

Once complete, you should initialize and format the iSCSI disks, using Disk Management. You can then use the iSCSI configuration page in Server Manager, to configure the disks as iSCSI targets and allow access from your cluster nodes. Because you have not created your cluster nodes yet, pre-planning of IP Addresses will be required!

You can now go ahead and build out the cluster nodes. To build the nodes, follow the same steps that you followed to create the Domain Controller and the File Server. Remember to change the NIC configuration to match the virtual network that is simulating the primary site subnet for nodes in the primary site, and virtual network simulating the DR site subnet, for the node in the DR site. There will be no need to add any additional disks to the nodes in the primary site, as they will be sharing the iSCSI disks that you just created, for all data.

Once the operating system has been installed, follow the same process as you did when configuring the file server, to assign a static IP Address to the server (make sure you assign the address that you specified for the iSCSI target access servers), configure the DNS Server and configure the default gateway. Then follow the same process as you did for the file server, to give the servers meaningful names, and join them to the domain.

The server in the DR site is now ready for use! The nodes in the primary site require some additional configuration, to use the shared disk(s), however. On each node that will share the iSCSI disk(s), use the iSCSI Initiator, which is available through Server Manager, to connect to the ISCSI target(s) that you created on the file server.

All servers will now be ready for use and you can begin to build your cluster, by installing the Cluster feature through Server Manager.

Full details of how to do this, as well as the rest of the cluster build process, can be found in the book SQL Server AlwaysOn Revealed 2nd Edition, which is available now.