Confidential
Version 1.6
date: 10/29/2018
SQL Configuration Guide
Ensuring High Avialability Configuations
Communication Devices Inc
85 Fulton St # 2, Boonton, NJ 07005
Table of Contents
SQL CONFIGURATION MANUAL Overview
MS SQL High Fidelity Mechanisms
Hot Backups: Database Mirroring
Authentication Configuration Steps
Manual Failover (Preferred) – The primary database is reachable
Forced Failover (Emergency) – Primary Database in not reachable
Installing the OBM on the Secondary server
Abbreviations and Tems List
Abbreviation or Term | Definition |
MS | Microsoft – Maker of Windows products |
OBM | Out-Of-Band Manager – a CDI product that monitors and allows access to the CDI secure OOB Devices (Port Authority) |
OOB | Out-Of-Band – a network engineering term referring to a non-primary channel |
SAMS | SIPS Analog Modem Server – an application that simulates analog modems using VOIP technology |
SIP | Session Initiation Protocol – a protocol generally used in VOIP to simulate a dial-up connection |
SSH | Secure Shell – a method of interfacing with a remote, usually Linux, machine via command line |
SSMS | SQL Server Management Studio – GUI for interacting with MS SQL Server |
Target Machine | The machine that the SAMS will be installed on |
RPM | Red Hat Packet Manager Package – contains all the files for a Linux application, as well how automates installation and removal |
This manual is meant to go over the recommended configuration of SQL databases in high availability environments. While CDI’s OBM will configure a SQLExpress instance for the user automatically, many want to incorporate Full MS SQL Server instances that are already part of their enterprise. This guide is meant to help guide administrators on how to configure these databases to make them more resilient to faults.
The manual is written for those with some knowledge of SQL databases and Windows, but a high level of permission in the Windows Domain, preferably Administrator. If the reader does not have Administrator access and has a some knowledge of SQL or Windows it will be very hard to identify and correct the enterprise specific security restrictions that may appear. Unless both servers are running as the same domain account, then raw SQL commands will need to be run.
Product | Version | Notes |
MS SQL Server | 2014+ | 2017 was used for this manual |
MS SSMS | 2014 | |
OBM | 7.0.9+ | .NET 4.5+ |
The following are mechanisms in MS SQL Server that allow for increased availability of databases. Each section will explain what the mechanism is and how to configure it.
MS SQL Server allows for databases to be backup-ed up in real-time so there is minimal, if any, loss of data if a primary database experiences a fault. When the fault is detected the SQL Server will immediately start treating the backup as the primary database. Database Mirroring has been the primary mechanism to accomplish this sin the early 2000’s and is straight forward and reliable. MS is trying to phase this out for their more robust, but complex Always On Availability Groups. AlwaysOn Availability groups require domain wide configurations, so DB Mirroring is preferred.
There are three schemes for MS SQL servers to authenticate with each other for mirroring: 1) have both servers running on same domain and/or same account 2) have servers running under accounts in different domains that can authenticate each other and 3) explicitly exchange certificates for authentication (no domain configuration needed).
Option 3 is the most popular because it does not require domain configuration (both servers can just run as local accounts); however, it does involved the most steps. Follow the steps before the “Creating the Mirror Database” section listed here. Once finished continue with the below steps except when configuring the Mirroring in the wizard you should already see the Endpoint name as “Endpoint_Mirroring “.
If you can run the servers under domain accounts (via the services manager) then Option 1 and 2 are less technical. If both servers are running under the same domain user then you can just proceed with the steps below. If they are different users in the same domain then you should be able to continue as well (especially if you are also part of that domain). If it does not work then you will need to follow the same steps as users of different domains. Users is different but accessible domains should run the commands below. Once finished continue with the below steps except when configuring the Mirroring in the wizard you should already see the Endpoint name as “Endpoint_Mirroring “. Reference
On the Primary Server, use SSMS to execute the following commands
CREATE ENDPOINT Endpoint_Mirroring
STATE=STARTED
AS TCP (LISTENER_PORT=7022)
FOR DATABASE_MIRRORING (ROLE=PARTNER)
GO
USE master ;
GO
CREATE LOGIN [SAME_OR_DIFF_DOMAIN\SERVER_BACKUP_ACCOUNT] FROM WINDOWS;
GO
GRANT CONNECT ON ENDPOINT::Endpoint_Mirroring TO [SAME_OR_DIFF_DOMAIN\SERVER_ BACKUP_ACCOUNT];
GO
On the Backup Server, use SSMS to execute the following commands
CREATE ENDPOINT Endpoint_Mirroring
STATE=STARTED
AS TCP (LISTENER_PORT=7022)
FOR DATABASE_MIRRORING (ROLE=PARTNER)
GO
USE master ;
GO
CREATE LOGIN [SAME_OR_DIFF_DOMAIN\SERVER_PRIMARY_ACCOUNT] FROM WINDOWS;
GO
GRANT CONNECT ON ENDPOINT::Endpoint_Mirroring TO [SAME_OR_DIFF_DOMAIN\SERVER_ PRIMARY_ACCOUNT];
GO
In the event that there is an error with the primary database, it will be necessary to ‘Role Switch’ the mirrored database into the new primary database. Once the Role Switch is complete the once mirroring database can be used exactly like the primary database.
Steps
Notes
In a Manual failover case, the primary SQL server is reachable and can directly signal to the mirrored backup to become the primary. You should not need to do anything to the other SQL server directly, this should signal to it to become the primary. Any active App Servers should now point to the once mirrored, now active SQL Server.
Once the former primary site is back up, it should already be in mirrored mode and recover any lost data once reconnected. You may then initiate a manual failover again, with both databases online to switch roles to their original configuration (for more read the Manual Failover section in Overview).
References
Steps
Notes
In the Forced Failover case there is a slight chance for a very small amount of data to be lost (that data which was mid transit during the Primary Servers failure). Given the frequency of write calls to our database this should be minimal.
Once the Forced Failover is issued, switch all active App Servers to the backup server.
To restore the original site, you will need to take a transition log backup from the working site and restore it on the original site in No Recovery Mode (see Roll Forward Link). Once that is done you should be able to configure the original site as a mirror (just use the Mirror wizard if the endpoint configuration is still there). Once in Mirror mode, you can transition it back into the primary by issuing the backup site Manual Failover, thus making it the mirror again the original site the Primary (see prior section steps).
References
The OBM on the PRIMARY SERVER is installed as per a standard OBM install using the OBM Manual.
For DB MIRRORING you need to perform a few extra steps to install the OBM on the SECONDARY SERVER
On the Primary Server
On the Mirror/Secondary Server
The IP Address will say LOCALHOST but once you click it will select the IP address of the APP server that was just installed. You may change this if you want to point to a different APP server – which you should not need to do.
On the Secondary Server
On the Primary Server
If there are two databases using “mirroring” then only the PRIMARY DB can be setup for automated backups. The PRIMARY will be backed-up to the MIRROR as well as to a scheduled backup to another location.
Use SQL Server Management Studio 2017 “SSMS” to manage your SQL Database
SSMS 2017 is available for download at no charge from the Microsoft Website.