Skip to main content

Enabling DB2 applications for HACMP Smart Assist

Lakshmi Priya Kanduru, Software Engineer, IBM
Lakshmi Priya Kanduru joined IBM in 2006 and is a software engineer on the HACMP team. She has worked on different configurations of HACMP Smart Assist and is interested in HACMP/XD technologies. You can reach her at lakshmipriya@in.ibm.com.

Summary:  HACMP Smart Assist validates the applications before getting them configured. This involves some preparation work for applications that are to be integrated with HACMP. This article documents the steps to enable DB2® applications for HACMP.

Date:  28 Oct 2008
Level:  Intermediate PDF:  A4 and Letter (148KB)Get Adobe® Reader®
Activity:  2709 views

Introduction

HACMP (High Availability Cluster MultiProcessing) is the IBM® high availability solution for business-critical applications on AIX®. It monitors applications and their resources for failures and automatically relocates them to another cluster node on failure to ensure high availability.

HACMP Smart Assist configures applications (WebSphere® Application Server, DB2, and Oracle) in cluster environments with minimal inputs, minimizing time and effort to integrate them with HACMP. They simplify the configuration of HACMP in conjunction with several applications. DB2 Smart Assist allows users to configure non-partitioned DB2 Universal Database instances under HACMP for high availability. DB2 Smart Assist supports DB2 V8.1 and V8.2.

This article gives a step-by-step approach to enable DB2 applications for HACMP as DB2 Smart Assist validates the installation of the application before configuring it under HACMP. This article assumes that we have a two-node cluster with Node1 as the primary node and Node2 as the failover/fallover/takeover/stand-by/secondary node, as shown below in Figure 1.


Figure 1. Primary and secondary nodes
Primary and secondary nodes

Before you begin, check out the DB2-specific requirements and the Smart Assist for DB2 User's Guide for planning the DB2 installation in the HACMP environment.

  1. Creating volume groups, logical volumes, and filesystems

    DB2 Smart Assist requires the DB2 instance's home directory to be on a shared volume group (vg).

     db2vg1 (shared)	-> (hdisk1 on Node1 and hdisk3 on Node2)

    It is recommended that you create the volume groups with the HACMP C-SPOC utility. You can also create logical volumes and filesystems using SMIT or AIX commands. To create the volume group, do the following on Node1.

    To create a volume group using C-SPOC, do the following:

    smitty hacmp 
       -> System Management(C-SPOC)
    	  -> HACMP Logical Volume Management
    	 	-> Shared Volume Groups
    			->  Create a Shared Volume Group. 
    

    Select the nodes appropriately to create a volume group.

    To create a volume group using AIX commands, enter:

    #umask 022
    # mkvg -f -V 70 -y db2vg1 hdisk1
    db2vg1
    #chvg -an db2vg1
    #mklv -t jfs2 -y dbinstance1 db2vg1 128
    dbinstance1
    #crfs -v jfs2 -d dbinstance1 -m /dbinstance1 -A no 
    #mount /dbinstance1
    

    To create a volume group using SMIT:

    smitty vg
       -> Add a volume group
           -> Add an original volume group 
    

    Enter the VOLUME GROUP name (db2vg1), select PHYSICAL VOLUME name (hdisk1) and change the Activate volume group AUTOMATICALLY at system restart? to NO and click Enter.

    To create a logical volume using SMIT, enter:

    smitty lv 
         ->Add a Logical Volume  

    Choose the VOLUME GROUP name(db2vg1) and fill the fields, Logical volume NAME(dbinstance1), number of LOGICAL PARTITIONS(128), PHYSICAL VOLUME names(hdisk1), logical volume TYPE(jfs2) and click Enter.

    To create a filesystem using SMIT, enter:

    smitty fs
     -> Add / Change / Show / Delete File Systems 
        -> Enhanced Journaled File Systems 
           -> Add an Enhanced Journaled File System on a Previously 
                          Defined Logical Volume 
    

    Enter the Logical Volume name (dbinstance1), the mount point (/dbinstance1), and set mount AUTOMATICALLY at system restart? to no and click Enter.

  2. Creating users and groups

    Create the DB2 users and groups on the primary node (Node1) and copy the entries to /etc/passwd, /etc/group, /etc/security/passwd, /etc/security/group, /etc/security/user files from primary node to all the fallover nodes. You can create groups and users using SMIT or with AIX commands.

    To create DB2 groups and users on the primary node, enter:

    
    #mkgroup id=515 dasadm1
    #mkuser id=515 pgrp=dasadm1 home=/dbinstance1/dasusr1 dasusr1
    #passwd dasusr1				
    Changing password for "dasusr1"
    dasusr1's New password:
    Enter the new password again:
    #pwdadm -c dasusr1
    #mkgroup id=516 db2grp1
    #mkgroup id=517 db2fgrp1
    #mkuser id=516 pgrp=db2grp1 groups=db2grp1,dasadm1 home=/dbinstance1/db2inst1 
                                 db2inst1
    #mkuser id=517 pgrp=db2grp1 home=/dbinstance1/db2fenc1 db2fenc1
    #passwd db2inst1
    Changing password for "db2inst1"
    dasusr1's New password:
    Enter the new password again:				
    #pwdadm -c db2inst1
    #passwd db2fenc1
    Changing password for "db2fenc1"
    dasusr1's New password:
    Enter the new password again:				
    #pwdadm -c db2fenc1
    

    Create groups (db2grp1, db2fgrp1, dasadm1) using SMIT:

    smitty
          ->Security and Users 
               ->Groups 
                    ->Add a Group 
    

    Enter the group name (db2grp1), set ADMINISTRATIVE group? to false and click Enter. Leaving the Group ID empty generates an available groupID automatically.

    Create users (db2inst1, dasusr1, db2fenc1) using SMIT:

    smitty 
           ->Security and Users 
                ->Users 
                    ->Add a user

    Enter the user name (db2inst1), Primary Group (db2grp1), Group SET (db2grp1, dasadm1) and home directory (/dbinstance1/db2inst1) and click Enter. Leaving the User ID empty generates an available userID automatically

    Assign or change password of a user:

    smitty 
           ->Security and Users 
                 ->Users
                     ->Change a User's Password 
    

    Select the user and click Enter.

  3. Installing DB2 on the primary node

    Before you start installation, ensure that:

    • All the system requirements were met, disk, memory, and more. Refer to the DB2 installation requirements for the AIX Operating System.
    • The DB2 product image is available.
    • The DB2 setup wizard is a graphical installer, so an 'X' Windows® software capable of running the Graphical User Interface is required for DB2 setup. Also ensure that "DISPLAY" is properly exported.

    To start the DB2 setup wizard:

    • Log in as root.
    • Change to the location of the DB2 product image(./product/disk1).
    • Run ./db2setup from the directory where the product image resides.
    • The IBM DB2 Setup Launchpad opens. You can view the Installation prerequisites, and the Release Notes from here or go directly to the installation.
    • Click Install Products.
    • Select DB2 UDB Enterprise Server Edition and click Next.
    • When the Welcome screen appears, click Next.
    • Select Accept to accept the Software License Agreement and click Next.
    • In the "Select Installation Type" screen, select Typical for the installation type. Click Next.
    • Select Install DB2 UDB Enterprise Edition Server on this computer and save your settings in a response file and click Next.
    • The following screen prompts you for User Information for the DB2 Administrator Server. Select Existing user and click the browse button (a box with three dots on it) and select All users in the primary group. Select dasusr1 in the selected group. Click OK then click Next .
    • Select Do not setup an instance in the "Setup a DB2 Instance" screen because the instance will be created manually. Click Next.
    • Set up the "SMTP Notification server" appropriately and click Next.

    The Summary screen shows the preferences specified for the product installation. Click Finish.

    The installation logs, db2setup.log and db2setup.err by default, are in the /tmp directory. Ensure that you provide adequate space in this directory. The db2setup.log file captures all DB2 installation information, including errors. The db2setup.err file captures any error output that is returned by Java™ (for example, exceptions and trap information).

    After installation is successful, run the following command to turn off the DB2 fault monitor:

    #chitab  fmc:2:off:/usr/opt/db2_08_02/bin/db2fmcd #DB2 Fault Monitor Coordinator 
    

  4. Run the following to create a shared Instance:
    #/usr/opt/db2_08_02/instance/db2icrt -a SERVER -s ese -u db2fenc1 
              -w 32 -p db2c_db2inst1 db2inst1
    
    #su - db2inst1	# become the instance owner
    db2start
    db2sampl		# create the sample database 
    db2 'connect to sample'
    db2 'select * from staff where dept=20'			
    db2 terminate
    db2stop
    exit
    

  5. Installing DB2 on standby node

    To umount varyoffvg on Node1:

    #umount /dbinstance1
    #varyoffvg db2vg1
    

    Do the following on Node2:

    #importvg -V 70 -y db2vg1 hdisk3
    db2vg1
    #chvg -an db2vg1
    #mount /dbinstance1
    

    Do ./db2setup as above and then run:

    #chitab  fmc:2:off:/usr/opt/db2_08_02/bin/db2fmcd #DB2 Fault Monitor Coordinator 
    

  6. Adding entries to /etc/services on failover nodes

    Copy the following entries in /etc/services on the primary node (Node1) to /etc/services on the takeover node (Node2).

    The entries in /etc/services on Node1 will look like the following:

    DB2_db2inst1    60000/tcp
    DB2_db2inst1_1  60001/tcp
    DB2_db2inst1_2  60002/tcp
    DB2_db2inst1_END        60003/tcp
    

    Before starting the DB2 instance on failover node Node 2, update the db2nodes.cfg file.

     #vi /dbinstance1/db2inst1/sqllib/db2nodes.cfg
    

    The middle column should be the hostname of the primary node. Change the hostname of the secondary node to the primary node's hostname.

    To change the hostname on the failover nodes:

    smitty hostname 
             -> set the Hostname 
    

    Enter the hostname of the primary node.

    Verify that you can start the instance on the takeover node (Node2).

    su - db2inst1
    db2start
    db2 'connect to sample'
    db2 'select * from staff where dept=20'			
    db2 terminate
    db2stop
    exit
    

  7. Mutual Takeover configuration

    If you are planning for Mutual Takeover configuration of HACMP (Refer to Smart Assist for DB2 User's Guide for information on Mutual Takeover configuration), then you need to install the second instance on the other shared volume group (say, db2vg2).

    #mkvg -f -V 70 -y db2vg2 hdisk4 
    db2vg2
    #chvg -an db2vg2
    #mklv -t jfs2 -y dbinstance2 db2vg2 128
    dbinstance2
    #crfs -v jfs2 -d dbinstance2 -m /dbinstance2 -A no 
    #mount /dbinstance2
    

    Then create the user db2inst2:

    #mkuser id=526 pgrp=db2grp1 groups=db2grp1,dasadm1 home=/dbinstance2/db2inst2 
                                  db2inst2
    #passwd db2inst2
    Changing password for  db2inst2 
    dasusr1's New password:
    Enter the new password again:				
    #pwdadm -c db2inst2
    

    Now create the instance:

    #/usr/opt/db2_08_02/instance/db2icrt -a SERVER -s ese -u db2fenc1 
    -w 32 -p db2c_db2inst2 db2inst2
    

    Create the database for db2inst2:

    #su - db2inst2		# become the instance owner
    db2start
    db2sampl		# create the sample database 
    db2 'connect to sample'
    db2 'select * from staff 			
    db2 terminate
    db2stop
    exit
    

    Now unmount the filesystem and varyoffvg on this node and import it to other cluster node. Make sure the user and group entries are copied to the /etc/passwd, /etc/group, /etc/security/passwd, /etc/security/group, and /etc/security/user files on the takeover nodes. Verify that you could run db2inst2 on this node (Node2).

  8. Adding DB2 applications to HACMP

    Install HACMP if it is has not previously been installed on all the nodes. Add the necessary entries to /etc/hosts on all the cluster nodes and configure a cluster. Refer to Configuring DB2 in an HACMP Cluster for configuring a cluster.

    Configure the service IP label:

    
    smitty hacmp
        -> Extended Configuration 
            -> Extended Resource Configuration
                 -> HACMP Extended Resources Configuration 
                      ->Configure Service IP Labels/Address 
                          -> Add a service IP Label/Address 
                              -> Configurable to multiple nodes.
    

    Select the Network and enter the IP that you are planning to use as service IP label for DB2 and click Enter.

    Synchronize the changes to all the cluster nodes:

    smitty hacmp
           -> Initialization and Standard Configuration 
                ->Verify and Synchronize HACMP Configuration. 
    

    To configure the DB2 application, enter:

    smitty hacmp
      -> Initialization and Standard Configuration 
            -> Configuration Assistants
                  -> Make Applications Highly Available (Use Smart Assists) 
                       -> Add an Application to the HACMP Configuration 
    

    HACMP will discover the nodes where DB2 is installed and will show the node names against DB2 Smart Assist in the selector screen, as shown below.



    Figure 2. DB2 Smart Assist selector screen
    DB2 Smart Assist selector screen

    Make sure that the node names are displayed properly against DB2 Smart Assistant.

    When you select the DB2 Smart Assistant, the following screen displays:



    Figure 3. Select the specific configuration screen
    Select the specific configuration         screen

    Choose your option and enter the application name, takeover nodes, database to be monitored, and service IP label, and click Enter. Smart Assist will add the DB2 instance(s) to the HACMP configuration. (Refer to Smart Assist for DB2 User's Guide for DB2 Smart Assist options).

Summary

Smart Assist helps minimize effort in configuring applications under HACMP. Once you enable DB2 applications for HACMP DB2 Smart Assist, HACMP will provide monitoring and recovery support for the application on failures.

Acknowledgments

I would like to thank Madan Chukka and Ravikiran Moningi for their valuable feedback.


Resources

Learn

Get products and technologies

Discuss

About the author

Lakshmi Priya Kanduru joined IBM in 2006 and is a software engineer on the HACMP team. She has worked on different configurations of HACMP Smart Assist and is interested in HACMP/XD technologies. You can reach her at lakshmipriya@in.ibm.com.

Comments (Undergoing maintenance)



Trademarks  |  My developerWorks terms and conditions

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=AIX and UNIX, Information Management
ArticleID=347601
ArticleTitle=Enabling DB2 applications for HACMP Smart Assist
publish-date=10282008
author1-email=lakshmipriya@in.ibm.com
author1-email-cc=mmccrary@us.ibm.com

My developerWorks community

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Special offers