Deploying the failover cluster
You now use the VM instances to deploy a Windows Server Failover Cluster and SQL Server.
Preparing SQL Server
Create a new user account in Active Directory for SQL Server:
- Connect to
node-1by using Remote Desktop. Sign in with your domain user account. - Right-click the Start button (or press Win+X) and click Windows PowerShell (Admin).
- Confirm the elevation prompt by clicking Yes.
Create a domain user account for SQL server and the SQL agent and assign a password.
$Credential = Get-Credential -UserName sql_server -Message 'Enter password' New-ADUser ` -Name "sql_server" ` -Description "SQL Admin account." ` -AccountPassword $Credential.Password ` -Enabled $true -PasswordNeverExpires $true
To configure SQL Server, perform the following steps on both node-1 and node-2:
Right-click the Start button (or press Win+X) and click Windows PowerShell (Admin).
Rename the SQL server instance so that its name matches the hostname.
$OLD_NAME = Invoke-Sqlcmd -Query " select @@SERVERNAME; GO" | ConvertTo-Csv | SELECT -Skip 2 $OLD_NAME = $OLD_NAME.Replace('"', '') Invoke-Sqlcmd -Query " sp_dropserver '$OLD_NAME'; GO sp_addserver '$env:computername', local; GO" Restart-Service -Name MSSQLSERVEROpen SQL Server Configuration Manager.
In the navigation pane, select SQL Server Services
In the list of services, right-click SQL Server (MSSQLSERVER) and select Properties.
Under Log on as, change the account.
- Account name:
DOMAIN\sql_serverwhereDOMAINis the NetBIOS name of your Active Directory domain. - Password: Enter the password you chose previously.
- Account name:
Click OK.
When prompted to restart SQL Server, select Yes.
SQL Server now runs under a domain user account.