Setup and Configure the Cluster

We will now setup and configure the cluster via Powershell as seen below:

  1. Within the jumpserver, and with Powershell ISE still up, open up a new tab by hitting CTRL+N, and entering the below script to create a cluster:

$nodes = "EC2SQL1", "EC2SQL2" #Defines the servers 
$vips = "10.150.10.101", "10.150.15.101" #These are one of the secondary IP addresses of the DB servers that we will be using as the Virtual IP of the cluster
$ClusterNm = "SQLCluster1" #Cluster Name
[string]$DomainName = (Get-WmiObject win32_computersystem).domain #extracts the domain name via PS
$FSWitness = '\\ec2jump\binaries' # defines the file-share location for the quorum configuration, which is already setup in the Jumpserver
$Clusterfqdn = "$ClusterNm.$DomainName" #generates the cluster FQDN required by the createquorum command 

New-Cluster -Name $ClusterNm -Node $nodes -StaticAddress $vips -NoStorage #This is the command that creates the cluster

Restart-Computer -ComputerName $nodes -Wait -For Wmi -Force -Protocol WSMan #initiates a restart, and waits for a response before continuing
Start-Sleep -s 30 #initiates a 30 sec wait

ipconfig /flushdns #resets dns cache, so the new AD cluster object would be available for further operations
DO
{
    $Failed = $false
    Try
    {
        Start-Sleep -s 60
        ipconfig /flushdns
        Set-ClusterQuorum -Cluster $Clusterfqdn -FileShareWitness $FSWitness #Defines the cluster quorum - this would be a File-Share Quorum
    } 
    catch 
    { 
        $Failed = $true 
    }
} 
WHILE ($Failed)
  1. Once executed, you should see a minimal output below:

  2. We can validate the new cluster using the Failover Cluster Manager tool, within the Administrative Tools:


  3. We can also validate the cluster AD object created along withe the actual cluster, using the Active Directory Users and Computers Tool: