In this blog post I will drive you through configurations steps required (with GUI screens) to successfully implement SQL server’s new high availability option called “ALWAYSON” aka HADR .
If you haven’t read more about Always ON or Availability groups in SQL server code named “Denali” version, here are some articles that I would recommend you read before using this blog post to configure SQL server’s new and cool feature.
http://technet.microsoft.com/en-us/library/cc645581%28SQL.110%29.aspx , http://technet.microsoft.com/en-us/library/cc645581%28SQL.110%29.aspx#TF9532 and http://technet.microsoft.com/en-us/library/ff877931%28SQL.110%29.aspx
In a nutshell, AlwaysON combines the working principle of database mirroring for making the database DR’ed in secondary site(s) in three different modes and extensively uses Windows Failover Clustering services for enhancing the failover capabilities thus creating AVAILABILITY GROUPS which can perform fail over for a group of databases. As like any other DR/HA solutions , AlwaysON has got its own set of DMVs that can be queried for management , maintenance and administrated by a SQL server DBA.
Note: This blog articles covers the AlwaysON features and functionalities as at CTP3 release which could be changed in the final RTM release.
Step 1: Configure Windows cluster and add nodes.
I have two VMs with Windows server 2008 R2 Enterprise edition 64 bit and SQL server Denali CTP3 x64 and I’m going to create a windows cluster just by adding 2 nodes and a virtual name for the cluster . Starting from Windows server 2008 failover cluster manager has to be enabled from roles and features applet. The cluster required for host Always on / HADR database doesn’t need to have shared storage or instance virtual name, the cluster can just be created and validated with a virtual name for it, I am using the virtual name for my cluster as SQLAlwaysON and the nodes are SQLCLU2 and SQLCLU3.
The configured windows cluster SQLAlwaysON looks as below
Nodes SQLCLU2 and SQLCLU3 are part of the cluster SQLAlwaysON
Step 2: Enable AlwaysON high availability for SQL services
Now the windows cluster SQLAlwaysON is setup with 2 nodes that has SQL server Denali CTP3 installed in it, the SQL server services in SQL server configuration manager will have the cluster name detected automatically.
Go to SQL server configuration manager and right click SQL server engine services and tab to the ‘AlwaysOnHighAvailability’ page, then tick the ‘enable AlwaysON high availabilities group’ on both the instances on both nodes.
This change requires SQL server services to be restarted on both the nodes/instances.
Step 3: Configure AlwaysON / HADR
Before continuing to configure the high availability group, decide the group of databases that you will be including. I have chosen Adventure Works database for this test purpose and I will configure HADR for these databases from SQLCLU2(Primary) to SQLCLU3(Secondary). I am seeing this feature as a perfect fit of SHAREPOINT server databases and all other pre written or custom apps that has multiple databases to work on
Image below shows instances I will be working on to configure AlwaysON for 4 adventure works database
Drill down the management folder and right click the Availability groups folder and choose New Availability group Wizard ,
The wizard opens up and looks like
Specify a name for availability group in the next window
Specify / Select the list of databases in the next screen .Only databases with FULL recovery model will be shown in this wizard .This page will exclude system databases and simple recovery database. Also to remember is , a database can either be configured for database mirroring or AlwaysON
In the next screen we must specify the Replica properties( SQL Servers instances that are part of the windows cluster SQLAlwaysON , in my case)
Options for Replica mode: Automatic failover, High Performance and High Safety – I’m choosing Automatic failover in my test case and each options here decides what purpose you are using AlwaysON for !
Options for Connection mode in secondary state: Disallow connection, allow all connections and allow only read-intent connections – I’m choosing allow only read-intent connections for the current secondary set of databases
Other tab on the same page is for specifying the ENDPOINT properties and the connect permissions for SQL service accounts same as Database mirroring
The next page lets us to create a DNS entry for this availability group which is the virtual name for this AG , eventually this will be data source name that App or client tools will use to connect to these group of databases
Now that all the properties , requirements are entered for AG creation the last screen is for starting the data synchronization
Once all the details are entered, the wizard configured the AlwaysON for us . As you can see only one database failed to be part of our HADR / Always group due to the filestream option not being enabled on the secondary instance SQLCLU3. We are not going to bother about it at least for now.
This wizard has given all summary/steps it has done to successfully accomplish the task. The failed items can be fixed later with the help of this screen.
Step 4: Look what’s happened
On the primary server SQLCLU2, open the availability group folder in management node of SSMS and look what’s newly included
As you can see the replicas are our 2 nodes and databases are Adventure works, the last item is interesting though. Group listener called MY_FIRST_ALWAYSON_LISTENER is configured as DNS entry to connect to the current PRIMARY SQL server and this is how its looks on secondary server SQLCLU3
AdventureWorks2008R2 database seems to be suspended as the restore did not succeed during AG configuration. Availability groups are now a server scoped objects ,any existing or newly created logins can be granted permissions on AG similar to an end point\server\login and server roles(only in Denali).
Now let’s have a look at the Windows failover cluster manager and see what’s interesting there
Successfully creating the availability group in SSMS creates an entry for service/application for our AG with the AG name we used during the configuration. This looks similar to our SQL server clustered instances on Windows clusters but not for the whole instance rather for just a group of databases.
Looking in to the MY_FIRST_ALWAYSON service/application for further details from the cluster manager
As you can see, the cluster resource is currently owned by SQLCLU2 which is our primary now and the DNS and IP address that we created for connecting to SQL server is also created as a dependent resource for this availability group.
From now it can be managed as similar to SQL server cluster but only for group of databases. You can flick them across nodes etc., and still use the same virtual name to connect to databases.
Now that we have successfully configured AlwaysON with “ONE” read only secondary, we should be able to force a manual failover or automatic failover for availability groups by shutting down the current primary server or SQL services. For configuring multiple replicas with CTP3 books online says to add the start up trace flag 9532.
You could use your apps to use the name my_first_alwayson_listener to connect to the AG databases and the AlwaysON resolves the current primary node and connects to that instance. Apart from this high availability option, we could use standalone instance named sqlclu3 (current secondary) to act as reporting database as it’s configured to be read only as per my test setup.I’m sure there’s lot more to test this before the final RTM release ,I will try all possible scenarios and come up with my latest findings. I would like to test with having both copies of replica to be read/write
I really love this feature as it gives high available option using Windows cluster failover and virtual naming methods, DR options with sticking on to principles of database mirroring and having multiple replicas to work on for various purpose there by segregating the load on your OLTP databases.
I’m AlwaysON, are you??
Leave a Reply