Community

Blog
×
Community Blog Deploying WSFC and the SQL Server Failover Cluster on Alibaba Cloud ECS

Deploying WSFC and the SQL Server Failover Cluster on Alibaba Cloud ECS

In this tutorial, we will deploy a SQL Server high availability (HA) solution with WSFC and the SQL Server Failover Cluster on an Alibaba Cloud Elastic Compute Service (ECS) Instance.

WSFC is a feature of the Windows Server platform, which is generally used to improve the high availability of applications and services on your network. WSFC is a successor to the Microsoft Cluster Service (MCS). SQL Server takes advantage of WSFC services and capabilities to support Always On availability groups and SQL Server failover cluster instances. We recommend you use Windows Server Failover Clustering (WSFC) and SQL Server AlwaysOn Availability Groups as your SQL Server high availability (HA) solution on Alibaba Cloud's Elastic Compute Service (ECS) instances.

An Alibaba Cloud ECS instance provides fast memory and the latest Intel CPUs to help you to power your cloud applications and achieve faster results with low latency. All ECS instances come with Anti-DDoS protection to safeguard your data and applications from DDoS and Trojan attacks.

The Alibaba Cloud ECS allows you to load applications with multiple operating systems and manage network access rights and permissions. Within the user console, you can also access the latest storage features, including auto snapshots, which is perfect for testing new tasks or operating systems as it allows you to make a quick copy and restore later. It offers a variety of configurable CPU, memory, data disk and bandwidth variations allowing you to tailor each Instance to your specific needs.

When using WSFC in conjunction with Alibaba Cloud ECS, if one cluster node fails, another node can take over. We can configure this failover to happen automatically, which is the usual configuration, or we can manually trigger a failover.

In this tutorial, we will deploy a SQL Server high availability (HA) solution with WSFC and the SQL Server Failover Cluster on an Alibaba Cloud ECS instance. This tutorial assumes a basic understanding of Alibaba Cloud's suite of products and services, the Alibaba Cloud Console, failover clustering, the Active Directory (AD), and the administration of Windows Server.

1.Introduction

1.1 The Architecture

We recommend the following configuration, which contains three servers and runs across the Alibaba Cloud Virtual Private Cloud (VPC) to provide an isolated cloud network to operate your resource in a secure environment:

Item Specification and version number
ECS CPU-4 Cores, Memory-16GB,
OS Windows Server 2016 DataCenter X64
SQL Server SQL Server 2016 Enterprise X64
Demo DB failover, created by HammerDB(SQL Server TPC-C)
Management SSMS (SQL Server Management Studio)

1

1.2 Prerequisites

For the purposes of this tutorial, we will assume the following tasks are complete:

  1. Install and configure the WSFC on an ECS instance
    1. This includes the installation and configuration of the Active Directory (AD) domain service and the CA (Certificate) service.
  2. Create an SQL Server instance.
  3. Configure your Windows settings to better optimize your SQL Server instance.
  4. Install and configure the SQL Server Always On feature.

2.Add SQL Server into the Domain

2.1 Configure Your NIC (Network Interface Card)

First, we need to configure the DNS of the management network card as the IP address of the AD server (which is 192.168.0.119 in this example).

  1. In Server Manager, click IPAM. The IPAM client console appears.
  2. In the navigation pane, in MONITOR AND MANAGE, click DNS and DHCP Servers. In the display pane, click Server Type, and then click DNS. All DNS servers that are managed by IPAM are listed in the search results.
  3. Locate the server where you want to add a zone, and right-click the server. Click Create DNS zone.
  4. The Create DNS Zone dialog box opens. In General Properties, select a zone category, a zone type, and enter a name in Zone name. Also select values appropriate for your deployment in Advanced Properties, and then click OK.

    2

  5. Type in the ipconfig cmd into Powershell, and the following information should appear:

    3


The IP address of the network card has been changed to a static IP address instead of the default DHCP assignment when creating the ECS. If we do not complete this step, there will be a problem when creating a failover cluster (you will not be able to find the input box for entering the cluster IP address.)

You can also check your Network Connection Details on the SQL Server UI:

4

2.2 Two Servers Join the Domain

Now, we need to change the system settings for the domain.

  1. Go to Control Panel > System and Security > System and click Change settings.

    5

  2. Add the domain name:
  3. When prompted, fill in your admin login details:
  4. If the following error appears, this is because the ECS Windows image and Alibaba Cloud image have the same SID.

    6

  5. You can check if this is the case by using the ipconfig cmd and checking your user SID:

    7

    If this is the case, you can modify the SID of both nodes using the following tutorial:

    https://www.alibabacloud.com/help/doc-detail/40846.htm

    The SID of Node-2 should now have changed after modification:

    8

  6. After the re-execute join domain operation succeeds, you will see a confirmation message on the AD controller.

3.Configure the iSCSI Target Server

The iSCSI server and AD domain server need to be combined. Here are the steps to configure the iSCSI target server and achieve this:

3.1 Creating a Cloud Disk and Mounting to iSCSI Server

  1. On Alibaba Cloud Console, select Block Storage > Cloud Disks.
  2. In the upper-right corner of the Disk List page, click Create Cloud Disk to go to the Create page.
  3. Select the same region and zone as your ECS instance.
  4. Select a cloud disk category and specify the disk size and the quantity. You can also choose Create a cloud disk from a snapshot.
  5. Confirm the configuration and the cost.
  6. Click Buy Now, confirm your order, and make the payment.

Go back to the Cloud Disks page and refresh it. You should see the following:

9

3.2 Add iSCSI Target Server Role

  1. In the Add Roles and Features Wizard, select Server Roles and check the iSCSI Target Server box.
  2. Click OK to start the installation. Once complete, the following should appear:

    10

3.3 Add iSCSI Virtual Disks

Next, create three virtual disks attached to the AD/iSCSI server as iSCSI virtual disks:

11

Add the desired name and size of the server.

Choose New iSCSI target

Target Name: iscsi-target-data

Then, create the iSCSI virtual disk.

After all three have been created, you will see the initial list of status, although these are not yet connected:

12

3.4 Mount the iSCSI Virtual Disk on the Servers

Next, initiate and configure your iSCSI initiators on two servers in the Cluster and make virtual disks on AD / ISCSI server as targets by:

  1. Click on Tools in the Server Manager Dashboard, then iSCSI Initiator:
  2. On the Discovery tab, click Discover Portal…

    13

  3. Add the DNS details and then click Advanced…

    14

  4. Make sure your local adapter is listed as Microsoft iSCSI Initiator and the correct IP address is shown:

    15

  5. Click Connect and the status of the three iSCSI targets becomes Connected:

    16

  6. Click the Volumes and Devices tab and click Auto Configure.
  7. When you return to the Files and Storage Services UI for the iSCSI, the status of all three targets should now appear as Connected.

    17

  8. If you check the online operations on all three iSCSI virtual disks, the following information should appear:

    18

4.Create WSFC

4.1 Validate Configuration

  1. Start the Failover Cluster Manager on the node WSFC-1:

    19

  2. Select the servers for WSFC-1 and WSFC-2 (which are 192.168.0.120 and 192.168.0.121 for this example):

    20

  3. Click OK and wait for the validation process to complete:
  4. When the Summary appears, make sure the Create the cluster now using the validated nodes… box is checked. Click Finish.

    21

4.2 Create the Cluster

  1. Next, assign the IP address in the segment 192.168.0.xxx as the IP address of the access point for the cluster, using the Create Cluster Wizard.

    22

  2. After the creation is complete, check the status is online:

    23

4.3 Add HAVIP to Alibaba Cloud Console

Alibaba Cloud no longer supports multi-IP on a single NIC. Even if you can attach multiple IP addresses on the same NIC, it cannot ping successfully.

24

By adding HAVIP (High Availability IP), this problem is circumvented:

  1. In the Alibaba Cloud VPC, locate the VPC where the network segment 192.168.0.xxx is located, click and enter the HAVIP on the left.
  2. After entering the user interface, click Create HAVIP Address in the upper right corner, select the correct VSwitch and use the cluster IP as the Private IP address:

    25

  3. Bind your ECS instances to HAVIP and look at the status. You can see that the current WSFC-2 node is in the Master state, consistent with the one seen above with the Failover Cluster Manager:

    26

  4. Ping the WSFC-1 node again to verify the cluster IP connectivity. The ping test should now work:

    27

4.4 Verification on Failover

  1. Click More Actions, click Move Core Cluster Resources and select the WSFC-1 node:

    28

  2. Check the status after the move operation:

    29

  3. At this point, view the corresponding HAVIP state in the Alibaba Cloud Console and you can see the WSFC-1 node is now the Master:

    30

  4. You can also check the status of node WSFC-1 from PowerShell:

    31

  5. At node WSFC-2, ping the cluster IP bound to WSFC-1 to verify the connection:

    32

4.5 Add a Disk in Cluster Manager

Now we need to add a disk by performing the following steps in the Cluster Manager:

  1. In Actions, click Add Disk and select all three cluster disks:

    33

  2. Click OK and check the status of each one is "Online".

4.6 Configure the Quorum Disk

The quorum is sometimes referred to as the Disk or File Witness. It is simply a small clustered disk which is in the available cluster storage group. To configure the quorum, you should:

  1. First, turn on maintenance mode on the quorum disk in the More Actions menu.

    34

  2. Then format it in Computer Management -> Disk Management and turn off the disk maintenance mode.

    NOTE: Disk formatting can be performed only on the node 1 server. You do not need to do it again on node 2. After cluster failover manager can move the disk resource to node 2, at the computer management -> disk management to see just format the disk is still NTFS format.

  3. Next, go to the quorum disk configuration settings:

    35

  4. Click the Select the quorem witness option.
  5. And select Configure a disk witness.
  6. Select the disk.
  7. And complete the quorum disk settings, clicking Finish when you are done:

    36

  8. Finally, check the status:

    37

4.7 Format Other Disks

The other two DATA and LOG disks are also formatted as NTFS. You can see that these two disks are now on the cluster's WSFC-2 node, so the states seen in disk management for WSFC-1 and WSFC-2 are as follows:

WSFC-1:

38

WSFC-2:

39

Turn off maintenance mode after formatting on the WSFC-2 node and check the status via Failover Cluster Manager:

For easy identification and operation, move all three disk resources to the WSFC-1 node.

4.8 Add Cluster Shared Volumes

Finally, click to add Cluster Shared Volumes to your configuration by following these screenshots:

40

41

You can view the shared volume on My Computer. This volume will be used for SQL Server.

42

5.Deploy SQL Server Failover Cluster

The SQL Server failover cluster is equivalent to the primary and secondary machines, while only one SQL Server service is running, the database is stored in shared storage and has only one copy.

We now need to deploy the SQL Server failover cluster using the following steps:

5.1 Run System Configuration Checker

First, check your system configuration by clicking the following tool on the SQL Server menu:

43

The following results should appear:

44

5.2 Install SQL Server Failover Cluster on WSFC-1

  1. Run the installer for SQL Server on the WSFC-1 node and select the New SQL Server failover cluster installation option:

    45

  2. Choose Database Engine Services and the following client related options in Shared Features:

    46

  3. Add the name of your SQL Server network:

    47

  4. Check Cluster Disk – Data:

    48

  5. Click OK.
  6. Add your login details for the server:

    49

  7. On the Server Configuration tab, make sure Mixed Mode is selected and enter the server login details:

    50

  8. Now, go to the Data Directories tab and enter the directory details:

    51

  9. Click OK to complete the installation:

    52

  10. Finally, check the status with the Failover Cluster Manager:

    53

  11. Add HAVIP for SQL-CLUSTER cluster IP. In this tutorial we have added a total of three HAVIPs:

    54

5.3 Add WSFC-2 as a SQL Server Failover Cluster Node

  1. Run the installer for SQL Server on the WSFC-2 node and select following option:

    55

  2. Enter the name of the node
  3. Add the login credentials
  4. Complete the installation

5.5 SQL Server Network Configuration

  1. Next, you need to configure the network in SQL Server Configuration Manager and set the IP addresses of all 127.0.0.1 and 192.168.0.xxx segments to Enabled = Yes

    56

  2. Restart SQL Server related services after this modification.

5.6 Check the SQL Server Status of Both Nodes

  1. View the current SQL Server running on node WSFC-1 with Failover Cluster Manager:

    57

  2. View on the WSFC-1 node:

    58

  3. You can see the cluster IP on SQL-CLUSTER listens on the port 1433:

    59

  4. If you view the WSFC-2 node, the SQL Server related services are Stopped.

    60

  5. View its status via the SSMS management tools. The SSMS is installed in the AD server (192.168.0.119), so enter the SQL-CLUSTER cluster IP address.
  6. You can also view the cluster shared storage details by clicking Databases and System Databases.
  7. Go to the Database Settings and check the default locations:

    61

6.Check Your Configuration

You have now to deployed WSFC and the SQL Server Failover Cluster on an Alibaba Cloud ECS instance. You can check your configuration with the following steps:

6.1 Generate test data with tool HammerDB

  1. Go to the download URL: http://www.hammerdb.com/download.html to download the HammerDB tool.
  2. When you open HammerDB, configure the Build Options and click Build to start generating data:

    62

  3. In SSMS, execute SQL statements to query part of the tpcc database data:

    63

6.2 Move SQL Server Failover Cluster to the WSFC-2 Node and Verify

  1. Click More Actions, click Move Core Cluster Resources and select the WSFC-2 node:
  2. Check the cluster is running on the node WSFC-2:

    64

Conclusion

That's it! You have now checked and verified your WSFC and the SQL Server Failover Cluster on an Alibaba Cloud ECS instance.

If you need any further help with your installation, please go to https://www.alibabacloud.com/help or contact one of the Alibaba Cloud Support team.

To read the other tutorials covering Windows Server Failover Clusters, SQL Servers and Windows Server Failover Clustering, visit:

https://www.alibabacloud.com/getting-started/projects.

1 0 0
Share on

Alibaba Clouder

814 posts | 117 followers

You may also like

Comments

5209830766159913 October 18, 2018 at 8:59 am

good

Alibaba Clouder

814 posts | 117 followers

Related Products

  • ECS(Elastic Compute Service)

    An online computing service that offers elastic and secure virtual cloud servers to cater all your cloud hosting needs.

    Learn More
  • Server Load Balancer(SLB)

    Alibaba Cloud Server Load Balancer is built to cope with high volume traffic and each year in November is put to the test during Alibaba’s annual Global Shopping Festival. Alibaba relies on Server Load Balancer to provide uninterrupted service during the festival by switching requests between data centers and transferring transactions to the most available server.

    Learn More
  • ApsaraDB for RDS

    An on-demand database hosting service for MySQL, SQL Server and PostgreSQL with automated monitoring, backup and disaster recovery capabilities

    Learn More