html5-img
1 / 45

High-Availability Methods

High-Availability Methods. Lesson 25. Skills Matrix. Skill Matrix. Redundancy. Redundancy means having another copy of your database somewhere. This can be a backup copy. This can be a replicated copy. This can be a mirrored copy. . High Availability.

brosh
Download Presentation

High-Availability Methods

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. High-Availability Methods Lesson 25

  2. Skills Matrix

  3. Skill Matrix

  4. Redundancy • Redundancy means having another copy of your database somewhere. • This can be a backup copy. • This can be a replicated copy. • This can be a mirrored copy.

  5. High Availability • You’ll get the following high-availability features with Enterprise Edition: • Replication • Distributed transactions • Failover clustering • Multiple instances (up to 50) • Log shipping • Database snapshots • Database mirroring

  6. High Availability • You’ll get the following high-availability features with Standard Edition: • Replication • Distributed transactions • Failover clustering (maximum two nodes) • Multiple instances (up to 16) • Log shipping • Database mirroring (synchronous with automatic failover only)

  7. Database Mirroring • Database mirroring allows you to create an exact copy of a database on a different server and implement high availability on the user database. • Database mirroring is a software solution, implemented on a database-per-database basis, and involves two copies of a database, with only one accessible by the user.

  8. Database Mirroring • Mirroring is a process that looks similar to log shipping; however, it involves a direct process between two separate instances of SQL Server. • Updates made to a database on the first server, called the principal server, are copied over, or are mirrored, to the target server, called the mirror server. • The process involves applying any transaction from the principal to the mirror.

  9. Principal Server • Principal server is your primary database, and as such will be your starting point in a database-mirroring session. • Every transaction that will be applied to this database will be transferred to the mirror using a process similar to distributed transactions. • When a database mirroring session starts, the mirror server asks the principal server’s transaction log for all transactions, based on the latest log sequence number.

  10. Mirror and Standby Server • The mirror is the database that will receive the copies from the principal server • This assumes that a persistent connection between the mirror and the principal exists. • The process of database mirroring is really one of maintaining a standby server (which means the mirrored database is not accessible by users) that you can easily switch over to in case of the principal server failing.

  11. Synchronous Mode • In synchronous mode, every transaction applied to the principal will also be committed (or hardened) on the mirror server before another transaction can begin. • You can consider this to be similar to distributed transactions, which means a transaction on the principal will be released only when it is also committed on the mirror. • Once it receives an acknowledgment from the mirror server, the principal will notify the client that the statement has completed.

  12. Asynchronous Mode • In asynchronous mode, the principal server sends log information to the mirror server, without waiting for an acknowledgment from the mirror server. • This means transactions commit without waiting for the mirror server to commit, or harden, the log file. • This mode allows the principal server to run with minimum transaction latency, and prohibits use of automatic failover.

  13. Preparing for Database Mirroring • To prepare for database mirroring, you need to perform three configuration steps: • Configure the security and communication between the instances. • Create the mirror database. • Establish a mirror session.

  14. Preparing for Database Mirroring

  15. Configuring Security and Communication between Instances • To establish a database mirror connection, SQL Server uses endpoints to specify the connection between servers. • You have to use a CREATE ENDPOINT statement. • Of course, in this communication, SQL Server performs authentication over the endpoints (mirror endpoint services), and you can achieve this by using Windows Authentication or certificate-based authentication.

  16. Creating the Mirror Database • To create a mirror database, you have to restore the full backup of a principal, including all other types of backup (transaction logs) you created on the principal, before you can establish a session. • It is important, however, that you use the NORECOVERY option when restoring from backup so the backup database will remain in a nonusable state. • The mirror database needs to have the same name as the principal database.

  17. Establishing a Mirror Session • Your next step in setting up database mirroring is to set up the mirror session on the database by identifying the mirroring partners. • On the principal database and on the mirror, you need to identify which partners are involved in database mirroring.

  18. Configuring a Witness Server • If you care about automatic failover, you should enable a witness server. • The witness server does nothing but monitor the status of the participants. • The good news is that you can have SQL Server Express Edition running on an old desktop computer participate as a witness in database mirroring.

  19. Operating Modes • To support database mirroring, you have different operating modes for specifying a transaction safety level. • The mode you use will impact how transactions are managed between the principal and mirror; also, you can choose whether to have automatic or manual failover with a potential loss of data. • Specifically, database mirroring works in three modes: • High availability • High protection • High performance

  20. High Availability • In this mode, the database transaction safety is set to FULL, and you will use a witness server to monitor the availability of the principal and mirror. • In this mode, every transaction applied to the principal will also be applied to the mirror. • When the connection to the principal fails, clients will be reconnected to the mirror automatically, after an automatic role transfer occurs.

  21. High Protection • In the absence of a witness server, database mirroring will run in high protection mode, which still allows every transaction applied to the principal to be applied to the mirror. • If the principal goes down, you can then manually force roles to switch, although a data loss can occur.

  22. High Performance • High-performance mode is also called asynchronous mode. • The chance of data loss is high since it is not guaranteed that the transactions applied to the principal are also applied to the mirror at the moment the principal fails.

  23. Switching Roles • A mirror database is a failover database for the principal, and that is what database mirroring is about. • So, when the principal server fails, you want to switch roles over to the mirror, and from then on specify that the mirror should become the primary. • You have three options for role switching: • Automatic failover • Manual failover • Forced service

  24. Log Shipping • Log shipping has existed in several releases of SQL Server. • To implement, you take a backup of a transaction log and restore that log onto another server, thus maintaining a standby server that can be used as a read-only server for different purposes, such as for Reporting Services or as your data engine to populate a data warehouse running SQL Server Analysis Services.

  25. Log Shipping • Log shipping consists of two servers: • The primary server in a log shipping configuration has the primary database you want to back up and restore on another server. • The secondary server hosts the database that maintains a copy of your primary database; and, of course, it is common that a server can maintain and host multiple copies of primary databases coming from multiple servers.

  26. Configuring Log Shipping • You can configure log shipping from within SQL Server Management Studio or by using the corresponding stored procedures. • To initialize log shipping, right-click the database you want to use as the primary database, and from the Tasks menu, select the Transaction Log Shipping option. • Then, click the Enable This As a Primary Database in a Log Shipping Configuration at the top of this properties page. • The next step is to specify the transaction log backup location and backup settings.

  27. Log Shipping Recovery Options • The last step in configuring log shipping is to configure the recovery mode on the Restore Transaction Log tab of the Secondary Database Setting dialog box. • For this recovery option, you have two options: • No Recovery Mode • Standby Mode

  28. No Recovery Mode • No Recovery Mode: If you choose No Recovery Mode, you will not be able to read from the database, and it will be a hot standby server that you will switch to when an error occurs.

  29. Standby Mode • If you choose the Standby Mode option, you will disconnect users from the secondary database while you perform a restore. In this mode, the database will return in a read-only mode after a restore operation is completed, and the database will then be accessible for you to, for example, populate your data warehouse environment or reporting services.

  30. Changing Roles • To perform a role change from the primary server to the secondary server, you need to perform an initial role change to be able to make future role changes. You can do this by following these steps: • Manually fail over from the primary server to the secondary server. • Disable the log shipping backup jobs on the initial primary server. • Configure log shipping on the secondary server (using the wizard).

  31. Database Snapshot • With a database snapshot, you have the ability to create a snapshot of your data, even before users start working with the data. • The cool features of database snapshots are the following: • Recovering from dropped objects • Recovering essentially any DML statement, such as insert/delete/update • Performing data comparisons

  32. Creating a Snapshot • There is no graphical interface for creating a database snapshot. • This means you have to switch to a database query window to initiate a snapshot of a database.

  33. Clustering • Clustering is a technology which uses the Windows Cluster Services to provide multiple server nodes each providing SQL Server services using a central shared database on shared disk drives typically setup in a SAN. • Clustering technology is based on Microsoft Cluster Services (MSCS). • This is often the first choice for administrators who desire a highly available database server.

  34. Clustering

  35. Clustering • Clustering operates at the SQL Server instance level, meaning that all the instance services are protected from a hardware failure. • In the event of a disaster, all databases, logins, jobs, and other server-level services move to the secondary server. • A failover cluster works by having various resources—in this case, including SQL Server— installed on the cluster’s nodes.

  36. Clustering • A nodeis any Windows server participating in the cluster. • At any given time, only one node can own a particular resource and use it to provide services to clients. • In the event of a disaster, the service fails over to another node that activates its copy of that service and begins responding to clients. • Disk resources are shared among all nodes, eliminating the need to keep a separate copy of any data for the resource synchronized on multiple nodes.

  37. Clustering • The following are some requirements to implement a cluster: • WSC-certified hardware • Shared disk resources such as a SAN • Geographic limitations • Additional network configuration • Additional costs

  38. Summary • In this lesson, you learned about several high-availability options and how to implement them. • Database mirroring uses TCP communication so that you can create an exact copy of a database at a remote location. • It also allows you to automatically switch over when implemented with a witness that monitors the connection and initiates the mirror to take over from the principal database.

  39. Summary • You also learned how to work with log shipping, which takes a copy of the transaction log and “ships” it to a remote destination. • To switch over to the remote standby server, you manually need to follow certain steps to perform the switch. • The standby server, however, has the capability to be used as a read-only server that you can use to populate a data warehouse, for ad hoc querying, or for reporting capabilities.

  40. Summary • Another effective method to implement is database snapshots. • This takes a “picture” of data and saves only the changes to the snapshot from the moment you take the initial snapshot. • Snapshots enable you to revert from user mistakes, but they do not provide fault tolerance.

  41. Summary • Consider fail-over clustering when your application absolutely must survive any catastrophe. • Place the servers in different buildings should one burn. • Route networks in such a manner that a back hoe tearing one line in two won’t disrupt an alternate path. • The weak link proves to be the common data store.

  42. Summary for Certification Examination • Familiarize yourself with the concept of database mirroring. Understand general terms, such as principal, mirror, and witness server. • If you want to invoke automatic failover, you can achieve this only by having a witness. • Database mirroring uses endpoints that communicate with each other using TCP. • You also need to know how you can manually force a mirror to take over the role of the principal server.

  43. Summary for Certification Examination • Understand log shipping. Know how to implement and use log shipping on a database—and keep in mind that this is implemented using transaction log backups. • The ability to specify the schedule on the transaction log backup, and when to restore initially, determines the latency between the recovery and failover strategy. • Log shipping is a manual failover process and allows you to have a hot standby server or read-only server that can be used for different purposes.

  44. Summary for Certification Examination • Understand database snapshots. In a database snapshot, it is important to remember that the snapshot does not implement high availability; it only records data changes to a snapshot database. • When retrieving data from a snapshot, the data will be partially read from the production database and so will get only the changed data pages from the snapshot.

  45. Summary for Certification Examination • Understand fail-over clustering. • This is a Windows Server solution available to SQL Server (and all other applications). • A heartbeat transmits between participating servers. When the heartbeat is not detected, automatic fail-over occurs. • This usually happens sufficiently rapidly that users don’t notice.

More Related