As the broker data will be stored in a DB2, this database needs to be under MSCS control. In this step, we will configure DB2 Enterprise Server to run with MSCS.
• Before starting, check that the user “wmbadmin” is in the “DB2ADMNS” and “DB2USERS” user groups.
You have to perform following steps on both nodes:
• Open a DB2 Command Window and get the DB2 instance list by running: o db2ilist
• You will see the default instance, “DB2” in the instance list. Drop this instance by running:
o db2idrop db2
Figure 5.51 – DB2 instance list
• Create a new DB2 instance named “DB2WMB” by running: o db2icrt DB2WMB –s ESE –u wmbadmin
• Get the DB2 instance list again by running: o db2ilist
Figure 5.52 – DB2 instance create and list
If you open the Windows Services, you should see a new created service that represents the instance.
In the case of an:
• Enterprise Server Edition (ESE) instance, the name of the service has the suffix:
“<INSTANCE-NAME>-<NODE NUMBER>”, for example, “DB2- DB2WMB-0”.
• Workgroup Server Edition (WSE) instance, the name of the service has suffix
<INSTANCE-NAME>”. If we have created a WSE instance, the service would be like “DB2-DB2WMB”.
This name is very important, as it will be the Windows Registry Key Name of the service. This means that the following entries must exist in the Windows registry:
• ESE instance: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\D B2WMB-0 • WSE instance: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\D B2WMB
Warning: The cluster software looks to this entry to start a highly available DB2 instance. This is usually the most common problem in setting up DB2 with
Windows Cluster. When creating a DB2 resource in MSCS, if you name it with a name that is different from this entry, the resource will not find the DB2 server and will not start. Renaming the resource will not solve the problem and you will have to recreate it.
In the next steps we will be configuring the DB2 instance in MSCS.
You have to perform following steps from the first node.
• We will start by adding the DB2 resource type to MSCS. Open a DB2 Command Windows and run following command:
o db2wolfi –i
Figure 5.53 – Adding the DB2 resource type to MSCS
• Open the Windows Cluster Administrator, expand your cluster tree and under “Cluster Configuration” find “Resource Types”. Check that “DB2 Server” is added.
Figure 5.54 – Checking the DB2 resource type
• You will need to create a directory in the shared disk to hold DB2 profiles. Open a Windows Command Prompt and run:
o mkdir F:\DB2PROFS
• In a DB2 Command Window, run the following command to move the instance “DB2WMB” to our cluster “SAW-WMB” and to place the DB2 instance profile directory in the directory “F:\DB2PROFS“:
o db2iclus MIGRATE /i:DB2WMB /p:DB2WMB /p:F:\DB2PROFS /c:SAW-WMB
• Get the DB2 instance list and check that the instance is moved to the cluster.
Figure 5.55 – Moving the DB2 instance to the cluster
• On the second node, get the DB2 instance list and check that the instance “DB2WMB” is existing and local.
• On the first node, we will use “db2iclus” command again with “ADD” clause to create references to the instance in the second node. Run:
o Instdb2iclus ADD /i:DB2WMB /m:SAW-ESB2 /c:SAW-WMB /u:wmbadmin
Figure 5.56 – Referencing the second node
• On the second node, get the DB2 instance list and check that the instance is moved to the cluster.
Figure 5.57 – DB2 instance list
Perform following steps on both nodes.
• Run following commands in a DB2 Command Window: o db2set db2instdef=DB2WMB
This command will set the default instance to “DB2WMB”. o db2 get instance
This command will list the default instance, “DB2WMB”. o db2systray +auto
This command will place a DB2 system tray icon for the default instance.
o db2 update dbm cfg using dftdbpath F:\
This command will set the default database path to the shared disk, “F:\”.
Figure 5.58 – DB2 commands
• Open “Windows System Properties > Advanced > Environment Variables”. Check that the “DB2INSTANCE” variable is not set to “DB2WMB”:
Figure 5.59 – The DB2INSTANCE environment variable
• Select the “DB2INSTANCE” variable and click “Edit”. Change the variable value to “DB2WMB”.
Figure 5.60 – The DB2INSTANCE environment variable
We will now perform steps to create the highly available DB2 instance resource.
• From the first node, open the Windows Cluster Administrator. Under “Groups”, right click on “WMB Group” and select “New > Resource”.
• The resource name must be exactly the same as the last part of the Windows service name of the DB2 instance. Type “DB2WMB-0” in the
Name field, select “DB2 Server” as Resource Type and select “WMB Group” from the Group dropdown box. Click “Next”.
Figure 5.61 – Adding the DB2 resource to the cluster group
• In the Possible Owners window, add all nodes in the cluster as the owners. Click “Next”.
• In the next window, add “Disk F:” and “WMB IP Address” to the “Resource dependencies” and click “Next”. With this configuration, the database resource will not be online until the IP Address and the shared disk holding its data are online. Click “Finish”.
Figure 5.62 – Adding dependencies
• Open Windows Services, find “DB2-DB2COPY1-DB2WMB-0” and change its startup to “Manual”. Check that the service is owned by “wmbadmin”.
Figure 5.63 – DB2 Windows Service
• From the Cluster Administrator, bring the “DB2WMB-0” resource online.
Figure 5.64 – All resources are online on the first node
• Right click on the “WMB Group” and select “Move Group”.
Figure 5.65 – All resources are online on the second node
• Right click on the “WMB Group” and select “Move Group”.
• Check that all resources are online on the first node again.
Hint: You can use the “db2mscs” utility to automate most of the steps of creating a highly available instance in MSCS. This command uses a configuration file that defines the user and password to create the services, the name and value of the resources like IP Addresses and network names, and so on. For further information about the usage of this utility, check the documents listed in the Resources section of this tutorial.
Optional: To check the data integrity of the shared disk, you can create a database (for example, “TESTDB”) with some test data, from the first node in the shared disk (for example, “F:\”). Then you can move the cluster group to the second node and connect to that database from the second node. Check that if you can successfully retrieve your sample data.