Administratin f SQL Server High Availability RNDr. David Hksza, Ph.D. http://siret.cz/hksza
Outline High availability in SQL Server 2008 failver clustering lg shipping mirrring High availability in SQL Server 2012 AlwaysOn
Failver Clustering Built n tp f a Windws Server Failver Cluster Installing SQL Server int an existing Windws cluster failver clustering instance SQL Server accessed using a netwrk name (virtual server name) If the server fails, SQL Server instance is failed ver t anther cluster server credit: SQL Server 2008 Administratin in Actin
Key Cmpnents/Terminlgy Shared strage the strage accessible frm each cluster nde allws failver Failver the act f anther server in the cluster grup taking ver where the failed server left ff Virtual server/failver clustering instance a cmbinatin f cnfiguratin infrmatin and cluster resurces, such as an IP address, a netwrk name, and applicatin resurces. the cnnectin t a virtual server can be hsted by any nde in the cluster and the client applicatin will nt knw which nde is actually hsting the virtual server
Key Cmpnents/Terminlgy Resurce a hardware r sftware cmpnent in a failver cluster (such as a disk, an IP address, r a netwrk name) Resurce grups Qurum a cmbinatin f resurces that are managed as a unit f failver lgically related resurces such as applicatins and their assciated peripherals and data in case f clustered SQL Server disks cntaining the database instance s data, transactin lgs, IP address, netwrk name, 3 applicatin services (SQL Server, SQL Server Agent, full-text service) cnfiguratin database fr Micrsft Cluster Service qurum lg file that is lcated n a disk hsted n a shared strage Qurum mdes Determines hw a nde in a cluster behaves when cnnectin with ther ndes is lst Nde Majrity, Nde and Disk Majrity, Nde and File Share Majrity, N Majrity: Disk Only
Tplgy Single-instance clusters active/passive ne nde is in the standby status easy t administer lw resurce utilizatin expensive Multi-instance clusters active/active secnd server is active and in case f failver ne nde takes in the wrklad f the ther nde higher resurce utilizatin N+1/M clusters ne r mre standby servers exist fr mre than ne wrking server credit: SQL Server 2008 Administratin in Actin
Prs/Cns Prs the entire instance and all f its databases are mved t a failver server in case f failure reduces dwntime during planned utages (manual failver) Cns single pint f failure (shared strage) usually n prtectin frm gegraphic disasters (can be cmbined with ther HA slutins)
Installing Failver Cluster Integrated installatin first the cluster is set up and then ndes are added ne by ne int the newly frmed cluster 1. SQL Server Installatin center a) New SQL Server failver installatin b) Add nde t a SQL Server failver cluster 2. select SQL Server netwrk name (NAME) + instance name (INSTANCE) the server can be accessed using NAME\INSTANCE (independent f its true lcatin) 3. cluster resurce grup name selectin 4. cluster disc selectin 5. cluster security plicy Advanced installatin
Lg Shipping warm standby Usage scenaris 1. Transactin lg backup 2. Lgs cpied t destinatin server 3. Lgs restred Offsite recvery pint Reprting slutin lg restratin independent n lg cpy credit: SQL Server 2008 Administratin in Actin
Lg Shipping Each surce DB can be lg shipped t multiple target DBs Surce database must be in full r bulk lgged recvery mdel Target database can be recvered in standby mde (readable) Establishing using SSMS Database cntext menu Tasks Ship Transactin Lgs
LS Failver and Rle Reversal 1. Disable the lg shipping backup, cpy, and restre SQL Server Agent jbs. 2. Manually run the backup, cpy, and restre SQL Server Agent jbs t push acrss any utstanding transactin lg backups. 3. Back up the transactin lg n the primary instance using the WITH NORECOVERY ptin (leaves the database in the RESTORING state). 4. Restre the backup frm step 3 n the secndary instance using the WITH RECOVERY ptin and redirect client cnnectins. 5. Set up lg shipping in the reverse directin.
Mirrring Maintaining ht standby cpy f database Each transactin is directly mirrred t the mirrr DB Certain types f data crruptin can be repaired by using crrect pages frm principal/mirrr (Enterprise) Mirrring ndes Asynchrnus high perfrmance (Enterprise) Synchrnus high safety (Standard, Enterprise) 1. Transactin written t lg 2. Lg recrd streamed t mirrr 3. Lg recrd hardened t transactin lg 4. Transactin cmmits n the principal 5. Transactin rlled frward n the mirrr DB credit: SQL Server 2008 Administratin in Actin
Mirrring Failver Optins Mirrring mde Witness Supprted failver mdes High perfrmance N Frced service High safety N Manual f frced service High safety Yes Autmatic, manual r frced service frced service frces the principal rle t mve t the mirrr database clients using SQL Server Native Client (SNAC) can include Failver Partner ptin in their cnnectin strings Data Surce=Instance1\DBName; Failver Partner=Instance2\DBName; Intial Catalg=DBName;
Mirrring - Restrictins Only full recvery mdel supprted Mirrr DB can be read nly if database snapsht is created n it Mirrring exists n database level nly System databases can t be mirrred Only ne mirrr fr ne principal Des nt supprt FileStream data
Cmparisn Attribute Clustering Lg shipping Mirrring Multiple database failver Yes N N Lgins, cnfig, and jb failver Yes N N Autmatic failver supprt Yes N Yes (ptinal) Autmatic client redirectin Yes N Yes Reprting N Yes (standby restre) Central pint f failure Disk N N Multiple standby destinatins N Yes N Gegraphical distance supprt Yes Yes Yes Data latency 0 15+min (cnfigurable) Yes (snapshts) 0 (synchrnus)
AlwaysOn High availability slutin in SQL Server 2012 Enerprise editin Targets weaknesses f failver clustering (shared strage) and mirrring (database-level, ne mirrr, SNAC-nly autmatic failver, reprting) Uses Windws Failver Cluster features but desn t use any shared strage AlwaysOn uses replicated cpies f the databases being prtected nt just ne cpy n shared strage as there is fr clustering