Configure AlwaysOn Failover Cluster Instances (SQL Server) using InfoSphere Data Replication Change Data Capture (CDC) on Windows Server 2012 Introduction As part of the SQL Server AlwaysOn offering, AlwaysOn Failover Cluster Instances leverages Windows Server Failover Clustering (WSFC) functionality to provide local high availability through redundancy at the server-instance level a failover cluster instance (FCI). An FCI is a single instance of SQL Server that is installed across Windows Server Failover Clustering (WSFC) nodes and, possibly, across multiple subnets. On the network, an FCI appears to be an instance of SQL Server running on a single computer, but the FCI provides failover from one WSFC node to another if the current node becomes unavailable. This document explains few basic concepts of Failover Cluster Instance and step by step configuration needed for setting up replication on database running on Windows Server 2012. We will use MS SQL SERVER 2012 database as the targeted database for configuring replication in this document. In a production environment, we recommend that you use static IP addresses in conjunction the virtual IP address of a Failover Cluster Instance. We recommend against using DHCP in a production environment. In the event of down time, if the DHCP IP lease expires, extra time is required to re-register the new DHCP IP address associated with the DNS name. 1 Configure AlwaysOn Failover Cluster Instances (SQL Server) using IIDR-CDC on window 2012
Figure1: Example of Failover Cluster Configuration MS SQL SERVER 2012 Failover Clustering Components The cluster configuration consists of two or more nodes, each of which acts as independent computer system. It appears to network clients as single server. The nodes in the cluster are connected using one or more storage buses and one or more independent networks. The network that connects only the servers is called private network, and the network that supports client machines is called as public network. Each shared storage is connected to one or more disks. Each disk is owned by only one node at a time in the cluster, as Microsoft cluster follows Shared nothing model. The MS SQL SERVER 2012 software resides on the local disk. The MS SQL SERVER 2012 database files (for example tables, indexes, and log files) reside on the shared disks. Database Resource In AlwaysOn Failover Cluster Instances, a resource type is a service such as shared disk, IP address that must be made highly available. Common Resources are IP Addresses MS SQL SERVER 2012 instances File shares Shared disks 2 Configure AlwaysOn Failover Cluster Instances (SQL Server) using IIDR-CDC on window 2012
Database Groups Related or dependent resources are organized into resource groups. All resources in a group move between cluster nodes as a unit. For example in a single partition DB cluster environment, there will be a DB group that contains the following resources DB resource : manages the DB instance IP Address resource : IP Address resource allows client applications Network name resource : Allows clients to connect to MS SQL server using name instead the IP One of more Physical Disk. DB Fail-over configurations There is one type of configurations available - Active Passive: All DB instances are active only at a single node at any point of type This document explains IIDR CDC configuration for database deployed in Active Passive failover cluster configuration with screen shots showing MS SQL SERVER 2012 as the database. Minimal requirements for setting up replication on database in Microsoft cluster To set up replication on cluster on Windows Server 2012 Standard failover cluster, you need, at minimum, the following resources: Windows 2012 domain Two nodes configured in failover cluster Two shared disks that can be accessed simultaneously from all the nodes Domain controller / Server Manager and DB Cluster service created on the domain DB cluster group created Fail over configured for DB cluster group In our example, we set up the above with the following resources Cluster manager / Domain controlled named cdcqacluster5.abc.com Two machines named CDCQANODE9 and CDCQANODE10, running Windows Server 2012 at abc.com domain Each node has two network cards, one for the private network and other for the public network One shared disk was created o Drive E : This disk is used for MS SQL table spaces and instance profile storage MS SQL SERVER Cluster Group called SQL Server created and ms sql server cluster service cdcsqlcluster5 registered in domain abc.com to access MS SQL SERVER cluster services using named service instead IP Address Note: To launch Fail over Cluster Manager go to Start Control Panel Administrative Tools Failover Cluster Manager 3 Configure AlwaysOn Failover Cluster Instances (SQL Server) using IIDR-CDC on window 2012
Figure 2: MS SQL SERVER Fail over Cluster Configuration in Failover Cluster Manager Below is the list of high level steps needed to set up highly available IIDR-CDC on MS SQL environment with Failover cluster. Detailed steps are mentioned in upcoming sections. 1. Install & Configure IIDR-CDC on the shared disk that all the nodes in the cluster has access to ( On Active Node ) 2. Create CDC Cluster service ( On Passive Node ) 3. Add CDC Generic Service to SQL Server cluster group ( On Both Nodes) 4. Create Data store in Management Console 5. Testing Failover 4 Configure AlwaysOn Failover Cluster Instances (SQL Server) using IIDR-CDC on window 2012
Install & Configure IIDR MS SQL CDC The configuration is done using the public network, in our example it is done on cdcqacluster5.abc.com 1. Log on to the Active node and install CDC on the shared disk. In our example we install on shared disk E: CDC has to be installed on the shared disk because during the failover CDC binaries file system has to be available on the same path in the failed over node 2. After the installation configure the instance with the port number and the data base credentials of the cluster server 5 Configure AlwaysOn Failover Cluster Instances (SQL Server) using IIDR-CDC on window 2012
Figure 3: CDC Instance Configuration Tool 3. After installation is complete do not start the instance. 6 Configure AlwaysOn Failover Cluster Instances (SQL Server) using IIDR-CDC on window 2012
Figure 4: CDC instance start/stop option Create CDC Cluster service 1. After creating the instance on the active node, to configure CDC in failover configuration, CDC cluster service has to be created on the passive node. 2. Execute dmcreateclusterservices command from %CDC_HOME%\bin directory dmcreateclusterservices.exe I <instance_name> passive_node_name Figure 5: CDC Cluster service 3. The above step creates Generic Cluster service on the passive node. 4. The CDC cluster service Startup type must be changes to Manual, Otherwise the failover won't be successful. Figure 6: CDC cluster service Startup type Add CDC Generic Service to SQL Server cluster role 1. After creating CDC cluster services start the CDC instance 7 Configure AlwaysOn Failover Cluster Instances (SQL Server) using IIDR-CDC on window 2012
Figure 7: CDC Instance Configuration Tool 2. To automatically failover CDC when MS SQL SERVER fails over, Add Generic Service of CDC under DB cluster resource group (SQL Server cluster role) 3. Launch Failover Cluster Manager and follow the steps as mentioned in the below screen shot. Right click the SQL Server role and select Add Resource -> Generic Service. 8 Configure AlwaysOn Failover Cluster Instances (SQL Server) using IIDR-CDC on window 2012
Figure 8: Failover Cluster Manager Adding Generic Service 4. Choose the right CDC service to be added. Select the service IBM InforSphere Data Replication [DEMO1] and click Next. CDC Service is identified by the name IBM InforSphere Data Replication (Microsoft SQL SERVER) [instance name] 9 Configure AlwaysOn Failover Cluster Instances (SQL Server) using IIDR-CDC on window 2012
Figure 9: Failover Cluster Manager Service Selection Once the service is added to the resources group, then it will not be displayed in the services list. 5. After selecting the service, make sure the service name is of the format dmtssql_<instance_name> for SQL server databases 10 Configure AlwaysOn Failover Cluster Instances (SQL Server) using IIDR-CDC on window 2012
Figure 10: Failover Cluster Manager Generic Service Summary 6. Add dependent resources that have to be brought online before bringing the CDC service online in case of failover. In our example, we use SQL server database and will add SQL server resource to be dependent before CDC resource is brought up. To add dependency, Right click the CDC resource and Go to dependency tab and add the list of dependencies as show in the below figure. You may choose to add many dependencies depending on your requirement. 11 Configure AlwaysOn Failover Cluster Instances (SQL Server) using IIDR-CDC on window 2012
Figure 11: Failover Cluster Manager Add Resource Dependency 7. CDC Cluster service remains in the offline mode when added for the first time, right click on the resource and select Bring this resource online as shown below. 12 Configure AlwaysOn Failover Cluster Instances (SQL Server) using IIDR-CDC on window 2012
Figure 12: Failover Cluster Manager CDC Cluster Service 8. After the resource is online, the active node (CDCQANODE9) in the cluster will have the ownership of the services 13 Configure AlwaysOn Failover Cluster Instances (SQL Server) using IIDR-CDC on window 2012
Figure 13: Failover Cluster Manager Online Resources Create Data store in Management Console 1. Create the data store in the management console, but instead of using the IP address use the cluster manager host name / High available IP address. Configuring with the cluster manager name makes sure during failover there is no need to change the IP address of the data store 14 Configure AlwaysOn Failover Cluster Instances (SQL Server) using IIDR-CDC on window 2012
Figure 14: Datastore Configuration Testing Failover 1. To verify the CDC failover cluster configuration, Right click the SQL Server role and select Move -> Select Node. 15 Configure AlwaysOn Failover Cluster Instances (SQL Server) using IIDR-CDC on window 2012
Figure 15: Failover Cluster Manager Moving the cluster resource role 2. All the cluster resources under the resource role will go to offline mode on active node CDCQANODE10 as shown in the below figure 16 Configure AlwaysOn Failover Cluster Instances (SQL Server) using IIDR-CDC on window 2012
Figure 16: Failover Cluster Manager Offline Resources 3. After successful failover you will notice all the resources including CDC cluster service will be made online on the failed over node CDCQANODE10 17 Configure AlwaysOn Failover Cluster Instances (SQL Server) using IIDR-CDC on window 2012
Figure 17: Failover Cluster Manager Failed over Resources 4. Do the failover operation from CDCQANODE10 to CDCQANODE9. The failover also is successful. 18 Configure AlwaysOn Failover Cluster Instances (SQL Server) using IIDR-CDC on window 2012
Figure 18: Failover Cluster Manager Failed over Resource 5. The failing over of CDC services as the source only automatically restart the CDC instances and does not restart the subscriptions. For the subscriptions to be restarted automatically, right click subscription properties and enable the option of persistent subscriptions. If this option is not enabled then subscriptions has to be restarted manually, no other configuration change is required. The failing over of CDC services as the target, whatever enable/disable the option of persistent subscriptions, The subscriptions has to be restarted manually. Conclusion By configuring CDC services to be part of database cluster resource group, it provides high availability to CDC instances when there is failover at node level or DB level. References 1. MSDN Online Support Library : https://msdn.microsoft.com/en-us/library/ms189134.aspx 2. IBM DB2 Infocenter : http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2fcom.ibm.db2.luw.admin.ha.doc% 2Fdoc%2Fc0007402.html 19 Configure AlwaysOn Failover Cluster Instances (SQL Server) using IIDR-CDC on window 2012
3. IBM Redbook : High Availability and Disaster Recovery Options for DB2 for Linux, UNIX, and Windows 20 Configure AlwaysOn Failover Cluster Instances (SQL Server) using IIDR-CDC on window 2012