Installing NiceLabel in Microsoft SQL failover cluster

Official translation unavailable. Translate this page with Google:

Problem

This article provides configuration and instructions to set up Microsoft SQL Server in the failover cluster. Microsoft SQL Server Always On is a marketing term that refers to the high-availability and disaster recovery solution that provides an enterprise-level alternative to database mirroring, introduced in Microsoft SQL Server 2012.

Requirements:

  • 1x NAS with iSCSI support

  • 2x virtual machine (in this case Windows Server 2016)

Specifications:

  • NAS has to run iSCSI server. Both virtual machines (nodes) IPsmust be provided on the iSCSI server to initialize the connection on the node side. Enable the Allow multiple sessions option.

    kb314-MultipleSessions.jpeg
  • Virtual machines.

    - Must have all the necessary connections and permissions to communicate with the NAS and the cluster.

    - Must have two network adapters – the first one is connected to the actual network/internet and the second one that serves only for HEARTBEAT connection between the nodes of the cluster.

Solution

The contents of this guide are delivered in the chapters. Process the chapters in the provided order.

  • Setting up cluster

  • Installing NiceLabel SQL Server 2019

  • Configuring Always On availability group

  • Installing NiceLabel Control Center

Setting up cluster

  1. Connect to first node.

  2. Open Server Manager and navigate to Tools > iSCSI Initiator.

  3. A dialog box pops up (... service is not running). Click Yes.

  4. On the Targets tab, enter NAS IP address and click Quick Connect...

    kb314-QuickConnect_big.png
  5. Quick connect finds all available targets to your server. Click Done,not Connect. This action lists the targets and you can connect to each target separately.

  6. When attempting to connect, click the target and continue with Connect.

    kb314-Connect_big.png
  7. Click Advanced... and enter your credentials in Enable CHAP log on section. Click OK, Enable multi-path, then click OK to establish a connection. The connection in iSCSI Initiator must be set up and running on both nodes at the same time – if not, then you probably don't have multiple connections allowed.

    kb314-Iscsi_big.png
  8. Once you connect all disks go to Disk Management on one node to bring them online and format them to NTFS.

  9. Set the disks to Offline mode in Disk Management and iSCSI Initiator, and set the disks to online mode on the second node to test their connection and availability.

  10. In the following steps, create the cluster. Select the node and set the disks to online mode only on that node.

  11. When you select the node, go to Server Manager > Manage tab > Add Roles and Features.

  12. On Installation Type keep Role-based or feature-based installation and continue with server (node) selection.

  13. In the Features section, skip Server Roles and select Failover Clustering.

    kb314-AddFeature_big.png
  14. Install Failover Clustering and open it by navigating to Tools > Failover Cluster Manager. Install this option on the second node as well otherwise the node is not found when performing validation for the cluster.

  15. Before creating the cluster, always run Validate Configuration.

    kb314-ValidateConfiguration_big.png
  16. Include both nodes at validating configuration. Validating configuration shows you existing errors or warnings.

    kb314-AddNodes_big.png
  17. Run all tests.

  18. If the tests pass successfully you can click the checkbox "Create the cluster now using the validated nodes..." and proceed with creating the cluster.

  19. Once cluster is formed you can check it by navigating to Server Manager > Tools and select Failover Cluster Manager.

  20. If the validation passed successfully you should see the cluster formed with a Witness disk.

    kb314-WitnessDisk_big.png
  21. Other available disks are listed under Storage → Disks.

Installing NiceLabel SQL Server 2019

  1. When you install the Always On Availability Groups you must meet the prerequisites:

    - A cluster node can host one replica for an availability group. The same node can't host two replicas from the same availability group. The cluster node can participate in multiple availability groups, with one replica from each group.

    - Each availability group requires a set of failover partners, known as availability replicas, which are hosted by instances of Microsoft SQL Server. A given server instance can be a stand-alone instance or a Microsoft SQL Server failover cluster instance (FCI).

    - If you use a Microsoft SQL Server failover cluster instance (FCI) to host an availability replica, you must understand the FCI restrictions and meet the FCI requirements. The Microsoft SQL Server instance should reside on a WSFC node.

  2. This article describes two nodes with two stand-alone SQL instances (not FCI).

  3. Install Microsoft SQL Server on both nodes. Go to the Installation tab in Installation Center and select New SQL Server stand-alone installation or add features to an existing installation.

  4. Proceed installation with recommended steps. In the Feature Selection dialog box, select the following components Database Engine Services.

    kb314-InstallDatabaseServiceEngine_big.png
  5. In the Instance Configuration dialog box leave Default instance if this is your only Microsoft SQL Server instance (by default it is MSSQLSERVER) or write your own Named instance and Instance ID. Use Instance ID to identify your server instance in the future.

  6. Continue with the recommended steps.

  7. In the Server Configuration dialog box, provide the credentials for the SQL Server service accounts in the Service Accounts tab. Select the checkbox Grant Perform Volume Maintenance Task privilege to SQL Server Database Engine Service. It enables Instant File Initialization for SQL Server.

    kb314-InstallGrantPerform_big.png
  8. In the Database Engine Configuration > Server Configuration tab:

    a. Select Mixed Mode (SQL Server authentication and Windows authentication) in the Authentication Mode section. Provide a password for the sa account.

    b. Click the Add Current User button in the Specify SQL Server Administrators section to add the currently logged on user to be a part of the SQL Server administrators group.

  9. Proceed with installation. Don't change Data Directories, TempDB , and FILESTREAM.

  10. When the installation is complete, close the dialog box.

  11. Repeat the installation steps 1-10 on the second node.

  12. When you install both instances, go to Microsoft SQL Server Configuration Manager and right-click on SQL Server instance. Select Properties.

  13. Enable Always On Availability Groups.

    kb314-EnableAlwaysOn_big.png
  14. Open SQL Server Network Configuration, click Protocols for [yourserverinstance] enable TCP/IP protocol, then restart the SQL Server.

    kb314-EnableTcpip_big.png
  15. Repeat steps 11-14 on both nodes.

  16. Verify the connection to the other node with SSMS (Microsoft SQL Server Management Studio). If the connection fails, check the solution:

    kb314-ProblemConnecting_big.jpeg

    - If you receive such an error, then you probably have an outdated or misconfigured SPN (Service Principal Names) entry.

    - Run Command Prompt as Administrator.

    - If you are using Windows Authentication/Domain credentials, then run the command:

    sqlcmd -S [servername] (example: sqlcmd -S server_name)

    - If you receive 1> in the next line, the connection was established successfully, and you can proceed by resolving this issue. If not, try to troubleshoot errors further.

    - You can resolve the original issue by removing the SPN entry in the attributes of the computer account in AD for the server.

    - Find the machine account in AD Users and Computers (using Advanced Features)

    kb314-SearchAdvancedFeatures_big.png

    - Double click the computer to which you want to establish the connection

    - Go to Attribute Editor and find servicePrincipalName. Click Edit.

    kb314-ServicePrincipal_big.png

    - If there are any MSSQLSvc entries you can delete them and add a new one. For example, MSSQLSvc/sqlserver05.local.

    Note: This is just one of the many possible solutions.

  17. Create two SQL users on both nodes: EPM_USER and EPM_DBADMIN.

  18. Go to SSMS on each node, navigate to Security, and right-click the Logins folder. Select New Login.

  19. Enter the name of the user, select SQL Server authentication, and provide the password. Disable User must change password at next login and Enforce password expiration.

  20. Write down the passwords, you will need them later.

  21. In the Server Roles tab, select sysadmin Server role.

  22. Click OK and repeat steps 18-20 for EPM_DBADMIN.

  23. Repeat the process on the second node.

Configuring Always On availability group

Microsoft SQL Server Always On consists of two technologies:

  • Always On Failover Clustering Instances (AlwaysOn FCI). Always On FCI uses shared storage like an iSCSI or Fibre Channel SAN that you can access by all of the nodes in your cluster. You can also use third-party data replication tools that can assist with the storage requirements if you don't have shared storage, or you want clusters for virtual machines, or in the cloud.

    Always On FCI is available on both Microsoft SQL Server Standard (2-node limit) and Enterprise Edition.

  • When you install Microsoft SQL Server, select the New SQL failover cluster installation option.

    kb314-scheme1.jpeg
  • Always On Availability Groups (Always On AG). AlwaysOn AG doesn't require shared disk storage for the server hosting the Microsoft SQL Server.

    kb314-scheme2.jpeg

You already installed Microsoft SQL Server on both nodes. Do the following:

  1. To create Always On Availability Group, create NiceAN database from scratch on the primary replica (node):

    a. Create a database on a primary node by using DBTool provided with NiceLabel installation.

    b. Run DBToolSFX and go to the DBTool folder.

    c. Run DBToolGui.exe.

    d. Select your local server with Windows Authentication and click Connect.

    kb314-dbt_WindowsAuthentication_big.png

    e. Enter Database information. Set Users creation to Assign required roles to the existing users. Set Authentication to SQL Server Authentication.

    kb314-dbt_Users_big.png

    f. Enter passwords for the EPM_DBADMIN and EPM_USER that you created in SSMS and click Create database.

    g. Save the configuration file in the same folder as the Control Center installation file. If you won't run Control Center on this node, you don't have to save the configuration file.

  2. Open SSMS and go to Always ON High Availability section, then select New Availability Group Wizard...

    kb314-NewAvailabilityGroup_big.png
  3. Skip the Introduction page and select Availability group name. Click Next.

  4. In the Select Databases section, first backup your database (right-click the database > Tasks > Back Up...). When the backup process is completed, click Next.

    kb314-SelectDatabase_big.png
  5. In Specify Replicas section, add your replica and then select:

    - Automatic Failover (Up to 2): Checked or unchecked (based on your preferences)

    - Synchronous Commit (Up to 3): Checked

    - Readable Secondary: Yes

    - In asynchronous-commit mode, the secondary replica never synchronizes with the primary replica. Asynchronous-commit mode can be useful in a disaster-recovery scenario in which the primary replica and the secondary replica are separated, and when you do not want small errors to impact the primary replica or when performance is more important than synchronized data protection. The primary replica doesn't wait for acknowledgments from the secondary replica so problems on the secondary replica never impact the primary replica.

    - In synchronous-commit availability mode (synchronous-commit mode), a secondary database catches up to the primary database and goes to the SYNCHRONIZED state. The secondary database remains SYNCHRONIZED as long as data synchronization continues. This enables every committed transaction on a primary database is also committed on the secondary database. When every secondary database on a secondary replica is synchronized, the synchronization-health state of the secondary replica is HEALTHY.

    - The Always On availability groups active secondary capabilities include support for read-only access to one or more secondary replicas (readable secondary replicas). A readable secondary replica can be in synchronous-commit availability mode or asynchronous-commit availability mode. A secondary replica allows read-only access to all its secondary databases.

  6. Configure Listener on Specify Replicas. Select the following options:

    - Enable Create an availability group listener.

    - Enter Listener DNS Name.

    - Port: 1433.

    - Select preferred Network Mode (for example, DHCP).

  7. In the Select Data Synchronization section don't change the Automatic seeding setting.

  8. Wait for validation to complete and create Availability Group.

    Note: Avoid using two databases with the same names on the nodes.

  9. To validate this availability group, you can open a connection in SSMS to the other node and confirm that databases exist on both nodes and are synchronized.

    kb314-Ssms_big.png
  10. Establish a connection to the listener that you created (by hostname or IP address). You can find the IP address in Failover Cluster Manager in the Always On availability group role in the resource section, or select the IP that you provided (if you didn't choose DHCP).

    kb314-IpAddress_big.png
  11. If the connection is successful, you can see your listener in the SSMS list with the primary database/databases.

    kb314-Ssms2_big.png
  12. To test if the availability group is working properly, go to the primary node and right-click on the availability group. Select Failover... and perform failover as instructed on the Failover Wizard.

    Make sure you are connected to the selected instance.

    kb314-ConnectReplica_big.png
  13. If failover is completed successfully you can see the change in Secondary/Primary node classification in the SSMS:

    kb314-Replicas_big.png

Installing NiceLabel Control Center

Installing Control Center on a computer that is not a part of your cluster.

  1. Start Control Center installation.

  2. Follow the wizard and enable Security Settings if you have an active SSL certificate. Leave other settings at their defaults.

  3. At the Microsoft SQL Server Instances step, type in your listener IP address and keep NiceAN for the database name. Click Next.

    kb314-cc_ServerName_big.png
  4. Enter Optional User Settings Changes for your selected database. Keep Windows Authentication in the Database Creation section and enter SQL users in the Users creation section:

    kb314-cc_DatabaseCreation_big.png
  5. Click Next to begin the installation.

  6. When setup is finished you are redirected to the browser window where you can access the Control Center.

  7. To test, if the Always On Availability Group is working properly, perform manual failover in SSMS and refresh the browser (including clearing cache in the browser).