The other night I was adjusting some quorum settings for the WSFC that was underlying a couple of AGs at work. Quorum needed fixing up as we were going to perform a site failover while some network switches were updated on the primary site, and I didn’t want to risk the potential of an outage should a WAN link go down between the primary DC and the DR DC. Fortunately PS makes this pretty simple, I just ensured that quorum would be maintained by the votes in the DR DC by removing them from a couple of machines in the primary DC:
(Get-ClusterNode -Name MySQLNode1).NodeWeight=0; (Get-ClusterNode -Name MySQLNode2).NodeWeight=0;
And then checking the votes on the WSFC to ensure that the DR site would stay up no matter what:
Get-ClusterNode | ft Name, NodeWeight -auto
Then I failed over the AG, I could have used T-SQL to do this in SSMS or SQLCMD:
ALTER AVAILABILITY GROUP MyAG ON REPLICA = 'MyDrSQLNode3' WITH (AVAILABILITY_MODE = SYNCHRONOUS_COMMIT); ALTER AVAILABILITY GROUP MyAG ON REPLICA = 'MyDrSQLNode3' WITH (FAILOVER_MODE = AUTOMATIC); ALTER AVAILABILITY GROUP MyAG FAILOVER;
But I’ve written a GUI interface to do this sort of thing in C#. This provides our NOC the ability to perform failovers themselves so that they can apply Windows CUs without having to call someone up to failover. The C# originally used T-SQL under the covers, but I’ve changed it recently so that it uses SMO (although have had to work around an issue using T-SQL):
AvailabilityGroup.Failover();
The once the FEX and switch work was completed I added the votes back to the primary DC and failed everything back again.
It was while I was doing all this that I got to thinking about just how absurd all of this stuff is.
- 20 years ago I would have laughed at the thought of all this random jargon and what it might mean
- 15 years ago I would have laughed at the though of Microsoft creating a proper shell language, with them preferring dim heavy VBScript
- 10 years ago I’d told you that you needed a disk quorum for your MSCS because otherwise you were going to have FCI problems with a machine was restarted
- 5 years ago I’d have laughed at the idea of using AGs for production (that laughter has turned to tears many times)
- 3 years ago the closest I would have gotten to C# would have been a tart orange
- 2 years ago the concept of being a major contributor to a large open source project would have been laughable
- 1 year ago I’d have given you an evil look at the merest mention of SMO
This stuff all moves so fast, it’s just ridiculous, there’s just no way to keep up with it all. Think of all the other changes over the last dozen years of SQL Server and Windows…things like DMVs, Azure, AWS, compression, TVPs, temp variables, CTEs, output clauses, lag and lead, partition by, partition tables, etc…
Spend a moment to think about all the stuff you’ve been through, for however long you’ve been doing this nonsense, and realize the absurd nature of it all.
By the way, this was deliberately acronym heavy, so here are some definitions:
- AG – Availability Group
- AWS – Amazon Web Services
- CTE – Common Table Expression
- DC – Data Center
- DMV – Dynamic Management View
- DR – Disaster Recovery
- FEX – Cisco Fabric Extender (network stuffs)
- FCI – Failover Cluster Instances
- GUI – Graphical User Interface
- MSCS – Microsoft Cluster Service (precursor to WSFC)
- NOC – Network Operations Center (those folks who are the first in line when something goes bad, and also the ones that have the lousy job of waking you up in the middle of the night because something went wrong)
- PS – PowerShell
- ft – Format-Table (in Get-ClusterNode command)
- -auto – automatically size data columns returned to the client
- Quorum – a majority of votes in a WSFC that is required to ensure that the clustering services stay online to ensure that there is not a risk of a split-brain scenario which could cause massive data problems (oversimplification)
- SMO – (SQL) Server Management Objects
- SQL – Structured Query Language
- SQLCMD – SQL Server Command Line Interface
- SSMS – SQL Server Management Studio
- T-SQL – Transact-SQL
- TVP – Table-Valued Parameters
- VBScript – Microsoft Visual Basic Scripting Edition
- WAN – Wide Area Network
- WSFC – Windows Server Failover Cluster
I’m pretty sure just going through all the SQL Server word salad is enough to drive a person to drink.