I have a SharePoint 2013 project in the works, and it is going to require a high availability solution. In preparation, I did what any DBA or IT professional should do—research and test a vast array of solutions, finding the best solution for my needs. Through my research, I concluded that SQL Server 2012 AlwaysOn Availability Groups will be the best fit for this situation. However, all the blogs I found had one thing in common; the solution involved installing and configuring SharePoint 2013, creating all the databases and then setting up the AlwaysOn Availability Groups. This is like putting the cart before the horse, in my opinion. Couldn’t we set up the Availability Group, set up the Availability Listener and then use the listener as the server name for the SharePoint install? Absolutely. In this post, I plan to show you how to do exactly that!
The first thing you will need to do is set up Windows Clustering and enable AlwaysOn High Availability. Go ahead; I’ll wait. All set? Great. Next, you will need to set up your Availability Group. You do this by first expanding AlwaysOn High Availability and then right-clicking on “Availability Group.” You will then want to click on “New Availability Group,” not the “New Availability Group Wizard.” The wizard will need at least one database to complete the setup, and we don’t have any databases, yet.
Give the Availability Group a name and click “OK.” This will create your Availability Group with only the primary replica server in the group. To add the secondary server to the Availability Group, you could right-click on “Availability Replicas,” but while adding the secondary replica in the Add Replica to Availability Group wizard, you will notice that the “Next” button does not become active. Clicking on the Endpoints tab in the wizard reveals that the endpoint for the first Primary Replica was not created when the Availability Group was created.
A better option would be to create the endpoint by first running the following script and then running the Add Replica to Availability Group wizard, but the choice is yours.
CREATE ENDPOINT Hadr_Endpoint
LISTENER_PORT = 5022
ROLE = ALL,
ENCRYPTION = REQUIRED ALGORITHM AES
This time, the “Next” button will be clickable after you add the Secondary Replica. Finally, you will need to add an Availability Group Listener by right-clicking “Availability
Group Listeners” and completing the New Availability Group Listener wizard.
Once the Availability Group Listener is created, you can use the Listener as the database server in the SharePoint install. Once the install is complete and the SharePoint databases are created, take a full backup of each and then add them to the Availability Group by right-clicking “Availability Databases” and clicking “add databases.” I have only tested this with SharePoint 2013, but I assume this would work with any application needing high availability. Try it out and let me know how it works for you; I would love to hear your feedback.