2. 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 90 #initiates a 90 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 10
    ipconfig /flushdns
    Set-ClusterQuorum -Cluster $Clusterfqdn -FileShareWitness $FSWitness #Defines the cluster quorum - this would be a File-Share Quorum
    }
    catch
    {
    $Failed = $true
    }
    }
    WHILE ($Failed)
    
  2. Once executed, you should see a minimal output below:

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

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

  5. The final step will be to run the Cluster Validation Process, when complete you will see output as shown below

    Test-Cluster -Node EC2SQL1,EC2SQL2