DB2 Cluster TSA

From Tuxunix
Jump to: navigation, search

Cluster DB2 (TSA)

Généralité

Cette procédure décris la mise en place d'un cluster TSA DB2 sur un point de montage exclusif avec la gestion de NetSearch Extender.

ClusterTSA.jpg

Pour information TSA s'appuie sur les outils RSCT (Reliable Scalable Cluster Technology), fournie lors de l'installation de DB2. RSCT sont des composants logiciels capable de comprendre le cluster sous AIX et Linux.

Pré-requis

Général

Partition des montages en format ext3

Pour chaque machine!

  • DB2 V9.5 (Fixpack 5)
  • DB2 NSE V9.5 (Fixpack 5)
  • RedHat 5.3
  • Installer les sample policies (sapolicies) (RPM fournie par IBM)
  • Mettre à jour RSCT (installer les derniers RPM RSCT)
  • Quorum device: ceci permet de vérifier au cluster qu'une bascule est réellement nécessaire ou non, exemple prendre IP de l'application
  • Ajouter la variable CT_MANAGEMENT_SCOPE qui identifie le nombre de noeud dans le fichier "/etc/profile"
# add for TSA/DB2 HA Configuration
export  CT_MANAGEMENT_SCOPE=2
  • Ajout le nom des noeuds dans "/etc/hosts"

Exemple :

x.x.x.x     db2clu2
x.x.x.x     db2clu1
  • Préparer les noeuds :
#> preprpnode db2clu1 db2clu2

db2haicu (DB2 High Availability Instance Configuration Utility)

Uniquement sur le premier noeud, dont les filesystemes sont montés (SAN, accés exclusif), et en user db2inst1 (compte de l'instance).

Ici répartition sur 3 montage :

1 - L'instance : /db2instance

2 - La database : /db2data

3 - Les index NSE : /db2textindex

  • Démarrer l'instance db2
#> su - db2inst1
$> db2start
SQL1063N  DB2START processing was successful.
$> db2haicu
Welcome to the DB2 High Availability Instance Configuration Utility (db2haicu).

You can find detailed diagnostic information in the DB2 server diagnostic log file called db2diag.log. Also, you can use the  utility called db2pd to query the status of the cluster domains you create.

For more information about configuring your clustered environment using db2haicu, see the topic called 'DB2 High Availability  Instance Configuration Utility (db2haicu)' in the DB2 Information Center.

db2haicu determined the current DB2 database manager instance is db2inst1. The cluster configuration that follows will apply to this instance.

db2haicu is collecting information on your current setup. This step may take some time as db2haicu will need to activate all  databases for the instance to discover all paths ...
When you use db2haicu to configure your clustered environment, you create cluster domains. For more information, see the topic  'Creating a cluster domain with db2haicu' in the DB2 Information Center. db2haicu is searching the current machine for an existing  active cluster domain ...
db2haicu did not find a cluster domain on this machine. db2haicu will now query the system for information about cluster nodes to  create a new cluster domain ...

db2haicu did not find a cluster domain on this machine. To continue configuring your clustered environment for high availability, you must create a cluster domain; otherwise, db2haicu will exit.

Create a domain and continue? [1]
1. Yes
2. No
1
Create a unique name for the new domain:
db2clu
Nodes must now be added to the new domain.
How many cluster nodes will the domain db2clu contain?
2
Enter the host name of a machine to add to the domain:
db2clu1
Enter the host name of a machine to add to the domain:
db2clu2
db2haicu can now create a new domain containing the 2 machines that you specified. If you choose not to create a domain now,  db2haicu will exit.

Create the domain now? [1]
1. Yes
2. No
1
Creating domain db2clu in the cluster ...
Creating domain db2clu in the cluster was successful.
You can now configure a quorum device for the domain. For more information, see the topic "Quorum devices" in the DB2 Information  Center. If you do not configure a quorum device for the domain, then a human operator will have to manually intervene if subsets of  machines in the cluster lose connectivity.

Configure a quorum device for the domain called db2clu? [1]
1. Yes
2. No
1
The following is a list of supported quorum device types:
 1. Network Quorum
Enter the number corresponding to the quorum device type to be used: [1]
1
Specify the network address of the quorum device:
x.x.x.x
Configuring quorum device for domain db2clu ...
Configuring quorum device for domain db2clu was successful.
The cluster manager found 6 network interface cards on the machines in the domain. You can use db2haicu to create networks for these network  interface cards. For more information, see the topic 'Creating networks with db2haicu' in the DB2 Information Center.

Create networks for these network interface cards? [1]
1. Yes
2. No
1
Enter the name of the network for the network interface card: eth0 on cluster node: db2clu1
1. Create a new public network for this network interface card.
2. Create a new private network for this network interface card.
Enter selection:
2
Are you sure you want to add the network interface card eth0 on cluster node db2clu1 to the network db2_private_network_0? [1]
1. Yes
2. No
2
Enter the name of the network for the network interface card: bond0 on cluster node: db2clu2
1. Create a new public network for this network interface card.
2. Create a new private network for this network interface card.
Enter selection:
1
Are you sure you want to add the network interface card bond0 on cluster node db2clu2 to the network db2_public_network_0? [1]
1. Yes
2. No
1
Adding network interface card bond0 on cluster node db2clu2 to the network db2_public_network_0 ...
Adding network interface card bond0 on cluster node db2clu2 to the network db2_public_network_0 was successful.
Enter the name of the network for the network interface card: bond0 on cluster node: db2clu1
1. db2_public_network_0
2. Create a new public network for this network interface card.
3. Create a new private network for this network interface card.
Enter selection:
1
Are you sure you want to add the network interface card bond0 on cluster node db2clu1 to the network db2_public_network_0? [1]
1. Yes
2. No
1
Adding network interface card bond0 on cluster node db2clu1 to the network db2_public_network_0 ...
Adding network interface card bond0 on cluster node db2clu1 to the network db2_public_network_0 was successful.
Enter the name of the network for the network interface card: eth2 on cluster node: db2clu2
1. db2_public_network_0
2. Create a new public network for this network interface card.
3. Create a new private network for this network interface card.
Enter selection:
2
Are you sure you want to add the network interface card eth2 on cluster node db2clu2 to the network db2_public_network_1? [1]
1. Yes
2. No
2
Enter the name of the network for the network interface card: eth2 on cluster node: db2clu1
1. db2_public_network_0
2. Create a new public network for this network interface card.
3. Create a new private network for this network interface card.
Enter selection:
2
Are you sure you want to add the network interface card eth2 on cluster node db2clu1 to the network db2_public_network_1? [1]
1. Yes
2. No
2
Enter the name of the network for the network interface card: eth0 on cluster node: db2clu2
1. db2_public_network_0
2. Create a new public network for this network interface card.
3. Create a new private network for this network interface card.
Enter selection:
2
Are you sure you want to add the network interface card eth0 on cluster node db2clu2 to the network db2_public_network_1? [1]
1. Yes
2. No
2
Retrieving high availability configuration parameter for instance db2inst1 ...
The cluster manager name configuration parameter (high availability configuration parameter) is not set. For more information, see the topic  "cluster_mgr - Cluster manager name configuration parameter" in the DB2 Information Center. Do you want to set the high availability configuration parameter?
The following are valid settings for the high availability configuration parameter:
 1.TSA
 2.Vendor
Enter a value for the high availability configuration parameter: [1]
1
Setting a high availability configuration parameter for instance db2inst1 to TSA.
Now you need to configure the failover policy for the instance db2inst1. The failover policy determines the machines on which the cluster  manager will restart the database manager if the database manager is brought offline unexpectedly.

The following are the available failover policies:
 1. Local Restart -- during failover, the database manager will restart in place on the local machine
 2. Round Robin -- during failover, the database manager will restart on any machine in the cluster domain
 3. Active/Passive -- during failover, the database manager will restart on a specific machine
 4. M+N -- during failover, the database partitions on one machine will failover to any other machine in the cluster domain (used with DPF instances)
 5. Custom -- during failover, the database manager will restart on a machine from a user-specified list
Enter your selection:
3
You can identify mount points that are noncritical for failover. For more information, see the topic 'Identifying mount points that are  noncritical for failover' in the DB2 Information Center.  Are there any mount points that you want to designate as noncritical? [2]
1. Yes
2. No
2
Active/Passive failover policy was chosen. You need to specify the host names of an active/passive pair.
Enter the host name for the active cluster node:
db2clu1
Enter the host name for the passive cluster node:
db2clu2
Adding DB2 database partition 0 to the cluster ...
Adding DB2 database partition 0 to the cluster was successful.
Do you want to configure a virtual IP address for the DB2 partition: 0? [2]
1. Yes
2. No
1
Enter the virtual IP address:
x.x.x.x
Enter the subnet mask for the virtual IP address x.x.x.x: [255.255.255.0]
x.x.x.x
Select the network for the virtual IP x.x.x.x:
1. db2_public_network_0
Enter selection:
1
Adding virtual IP address x.x.x.x to the domain ...
Adding virtual IP address x.X.x.x to the domain was successful.
The following databases can be made highly available:
  Database: XXXX
Do you want to make all active databases highly available? [1]
1. Yes
2. No
2
Do you want to make the database XXXX highly available? [1]
1. Yes
2. No
2
All cluster configurations have been completed successfully. db2haicu exiting ...
  • db2haicu à intégré seulement le point de montage de l'instance, nous allons donc intégré les autres points de montage :
$> lssam
Online IBM.ResourceGroup:db2_db2inst1_0-rg Nominal=Online
       |- Online IBM.Application:db2_db2inst1_0-rs
               |- Online IBM.Application:db2_db2inst1_0-rs:db2clu1
               '- Offline IBM.Application:db2_db2inst1_0-rs:db2clu2
       |- Online IBM.Application:db2mnt-db2instance-rs
               |- Online IBM.Application:db2mnt-db2instance-rs:db2clu1
               '- Offline IBM.Application:db2mnt-db2instance-rs:db2clu2
       '- Online IBM.ServiceIP:db2ip_x_x_x_x-rs
               |- Online IBM.ServiceIP:db2ip_x_X_x_x-rs:db2clu1
               '- Offline IBM.ServiceIP:db2ip_x_x_x_x-rs:db2clu2

Ajout de point de montage au RG (Ressource Group)

En tant que db2inst1 :

$> db2haicu
Welcome to the DB2 High Availability Instance Configuration Utility (db2haicu).

You can find detailed diagnostic information in the DB2 server diagnostic log file called db2diag.log. Also        , you can use the utility called db2pd to query the status of the cluster domains you create.

For more information about configuring your clustered environment using db2haicu, see the topic called 'DB2         High Availability  Instance  Configuration Utility (db2haicu)' in the DB2 Information Center.

db2haicu determined the current DB2 database manager instance is db2inst1. The cluster configuration that f        ollows will apply to this instance.

db2haicu is collecting information on your current setup. This step may take some time as db2haicu will nee        d to activate all databases  for the instance to discover all paths ...
When you use db2haicu to configure your clustered environment, you create cluster domains. For more informa        tion, see the topic  'Creating a cluster domain with db2haicu' in the DB2 Information Center. db2haicu is se        arching the current machine for an existing  active cluster domain ...
db2haicu found a cluster domain called db2clu on this machine. The cluster configuration that follows         will apply to this domain.

Select an administrative task by number from the list below:
 1. Add or remove cluster nodes.
 2. Add or remove a network interface.
 3. Add or remove a highly available database.
 4. Add or remove a mount point.
 5. Add or remove an IP address.
 6. Add or remove a non-critical path.
 7. Move DB2 database partitions and HADR databases for scheduled maintenance.
 8. Change failover policy for this instance.
 9. Create a new quorum device for the domain.
 10. Destroy the domain.
 11. Exit.
Enter your selection:
4
Do you want to add or remove mount points to or from the domain? [1]
1. Add
2. Remove
1
Enter the full path of the mount you wish to add to the cluster:
/db2data
Adding mount point /db2data to the cluster ...
Adding mount point /db2data to the cluster was successful.
Do you want to add another mount point to the cluster? [1]
1. Yes
2. No
1
Enter the full path of the mount you wish to add to the cluster:
/db2indextext
Adding mount point /db2indextext to the cluster ...
Adding mount point /db2indextext to the cluster was successful.
Do you want to add another mount point to the cluster? [1]
1. Yes
2. No
2
Do you want to make any other changes to the cluster configuration? [1]
1. Yes
2. No
2
All cluster configurations have been completed successfully. db2haicu exiting ...


  • Vérification :
$> lssam
Online IBM.ResourceGroup:db2_db2inst1_0-rg Nominal=Online
       |- Online IBM.Application:db2_db2inst1_0-rs
               |- Online IBM.Application:db2_db2inst1_0-rs:db2clu1
               '- Offline IBM.Application:db2_db2inst1_0-rs:db2clu2
       |- Online IBM.Application:db2mnt-db2data-rs
               |- Online IBM.Application:db2mnt-db2data-rs:db2clu1
               '- Offline IBM.Application:db2mnt-db2data-rs:db2clu2
       |- Online IBM.Application:db2mnt-db2indextext-rs
               |- Online IBM.Application:db2mnt-db2indextext-rs:db2clu1
               '- Offline IBM.Application:db2mnt-db2indextext-rs:db2clu2
       |- Online IBM.Application:db2mnt-db2instance-rs
               |- Online IBM.Application:db2mnt-db2instance-rs:db2clu1
               '- Offline IBM.Application:db2mnt-db2instance-rs:db2clu2
       '- Online IBM.ServiceIP:db2ip_x_x_x_x-rs
               |- Online IBM.ServiceIP:db2ip_x_x_x_x-rs:db2clu1
               '- Offline IBM.ServiceIP:db2ip_x_x_x_x-rs:db2clu2

Ajout de la gestion de NSE

  • Lister les ressources d'une ressource :
$> lsrsrc -s "Name=='db2mnt-db2data-rs'" IBM.Application
Resource Persistent Attributes for IBM.Application
resource 1:
       Name                  = "db2mnt-db2data-rs"
       ResourceType          = 0
       AggregateResource     = "0x2028 0xffff 0x109aca26 0x9d138c3a 0x921b2cca 0x6fca62a8"
       StartCommand          = "/usr/sbin/rsct/sapolicies/db2/mountV95_start.ksh /db2data"
       StopCommand           = "/usr/sbin/rsct/sapolicies/db2/mountV95_stop.ksh /db2data"
       MonitorCommand        = "/usr/sbin/rsct/sapolicies/db2/mountV95_monitor.ksh /db2data"
       MonitorCommandPeriod  = 10
...


Ajout des script start/stop/monitor

Scripte à placer dans les sapolicies : "/usr/sbin/rsct/sapolicies/db2/"

  • db2text_monitor.ksh
#!/bin/ksh -p
# FUNCTION: Monitor method for filesystem in TSA cluster
#
# Return 1 if DB2 Text Extenter is started
# Return 2 otherwise
#
#-----------------------------------------------------------------------
PATH=/bin:/usr/bin:/sbin:$PATH

INSTANCE=${1?}
VERBOSE=${2:-noverbose}

if  "$VERBOSE" == "verbose" ; then
  typeset -ft $(typeset +f)
  set -x
else
  # Close stdout and stderr
  exec 2> /dev/null
  exec 1> /dev/null
  set +x
fi

export CT_MANAGEMENT_SCOPE=2

rc=2
if [ -f ~$INSTANCE/sqllib/db2profile ]
then
 su - $INSTANCE -c "db2text control status; if [ \$? -eq 0 ];then rc=1;else rc=2;fi;exit \$rc"
 rc=$?
 if [ $rc -eq 1 ]
 then if [ $(ps -ef | grep ctelock | grep -vc grep) -ne 1 ];then rc=2;fi
 fi
fi

exit $rc
  • db2text_start.ksh
#!/bin/ksh -p
# FUNCTION: Monitor method for filesystem in TSA cluster
#
# Return 0 if DB2 Text Extenter is started successfully
# Return 1 otherwise
#
#-----------------------------------------------------------------------
PATH=/bin:/usr/bin:/sbin:$PATH

INSTANCE=${1?}
VERBOSE=${2:-noverbose}

if  "$VERBOSE" == "verbose" ; then
  typeset -ft $(typeset +f)
  set -x
else
  # Close stdout and stderr
  exec 2> /dev/null
  exec 1> /dev/null
  set +x
fi

export CT_MANAGEMENT_SCOPE=2


let MAXOCCURS=10
let i=0
rc=1
while [ $i -lt $MAXOCCURS ]
do
 if [ -f ~$INSTANCE/sqllib/db2profile ]
 then
   su - $INSTANCE -c "db2text control status; exit \$?"
   if [ $? -eq 0 ];then rm -f /tmp/$(echo "$INSTANCE"|tr '[a-z]' '[A-Z]').TEXT.*; fi
   su - $INSTANCE -c "db2text start;sleep 1; db2text control status; exit \$?"
   rc=$?
   break
 else
   sleep 1
 fi
 let i=$i+1
done

exit $rc
  • db2text_stop.ksh
#!/bin/ksh -p
# FUNCTION: Monitor method for filesystem in TSA cluster
#
# Return 0 if DB2 Text Extenter is stopped successfully
# Return 1 otherwise
#
#-----------------------------------------------------------------------
PATH=/bin:/usr/bin:/sbin:$PATH

INSTANCE=${1?}
VERBOSE=${2:-noverbose}

if  "$VERBOSE" == "verbose" ; then
  typeset -ft $(typeset +f)
  set -x
else
  # Close stdout and stderr
  exec 2> /dev/null
  exec 1> /dev/null
  set +x
fi

export CT_MANAGEMENT_SCOPE=2

rc=0
if [ -f ~$INSTANCE/sqllib/db2profile ]
then
 su - $INSTANCE -c "db2text stop; sleep 1; db2text control status; if [ \$? -eq 0 ];then rc=1;else rc=0;fi;exit \$rc"
 rc=$?
fi

exit $rc
exit 0

Intégration au ressource groupe

#> mkrsrc IBM.Application Name="db2text-db2inst1-rs" MonitorCommand="/usr/sbin/rsct/sapolicies/db2/db2text_monitor.ksh db2inst1" StopCommand="/usr/sbin/rsct/sapolicies/db2/db2text_stop.ksh db2inst1" StartCommand="/usr/sbin/rsct/sapolicies/db2/db2text_start.ksh db2inst1" MonitorCommandPeriod=10 MonitorCommandTimeout=120 StopCommandTimeout=330 StartCommandTimeout=600 UserName="root" NodeNameList="{'db2clu1','db2clu2'}"
  • On arête le ressource groupe pour intégration d’une nouvelle ressource :
#> chrg -o offline db2_db2inst1_0-rg
#> lssam
Offline IBM.ResourceGroup:db2_db2inst1_0-rg Nominal=Offline
       |- Offline IBM.Application:db2_db2inst1_0-rs
               |- Offline IBM.Application:db2_db2inst1_0-rs:db2clu1
               '- Offline IBM.Application:db2_db2inst1_0-rs:db2clu2
       |- Offline IBM.Application:db2mnt-db2data-rs
               |- Offline IBM.Application:db2mnt-db2data-rs:db2clu1
               '- Offline IBM.Application:db2mnt-db2data-rs:db2clu2
       |- Offline IBM.Application:db2mnt-db2indextext-rs
               |- Offline IBM.Application:db2mnt-db2indextext-rs:db2clu1
               '- Offline IBM.Application:db2mnt-db2indextext-rs:db2clu2
       |- Offline IBM.Application:db2mnt-db2instance-rs
               |- Offline IBM.Application:db2mnt-db2instance-rs:db2clu1
               '- Offline IBM.Application:db2mnt-db2instance-rs:db2clu2
       '- Offline IBM.ServiceIP:db2ip_x_x_x_x-rs
               |- Offline IBM.ServiceIP:db2ip_x_x_x_x-rs:db2clu1
               '- Offline IBM.ServiceIP:db2ip_x_x_x_x-rs:db2clu2
  • Ajout de la ressource dans le RG
#> addrgmbr -g db2_db2inst1_0-rg IBM.Application:db2text-db2inst1-rs
#> lssam
Offline IBM.ResourceGroup:db2_db2inst1_0-rg Nominal=Offline
       |- Offline IBM.Application:db2_db2inst1_0-rs
               |- Offline IBM.Application:db2_db2inst1_0-rs:db2clu1
               '- Offline IBM.Application:db2_db2inst1_0-rs:db2clu2
       |- Offline IBM.Application:db2mnt-db2data-rs
               |- Offline IBM.Application:db2mnt-db2data-rs:db2clu1
               '- Offline IBM.Application:db2mnt-db2data-rs:db2clu2
       |- Offline IBM.Application:db2mnt-db2indextext-rs
               |- Offline IBM.Application:db2mnt-db2indextext-rs:db2clu1
               '- Offline IBM.Application:db2mnt-db2indextext-rs:db2clu2
       |- Offline IBM.Application:db2mnt-db2instance-rs
               |- Offline IBM.Application:db2mnt-db2instance-rs:db2clu1
               '- Offline IBM.Application:db2mnt-db2instance-rs:db2clu2
       |- Offline IBM.Application:db2text-db2inst1-rs
               |- Offline IBM.Application:db2text-db2inst1-rs:db2clu1
               '- Offline IBM.Application:db2text-db2inst1-rs:db2clu2
       '- Offline IBM.ServiceIP:db2ip_x_x_x_x-rs
               |- Offline IBM.ServiceIP:db2ip_x_x_x_x-rs:db2clu1
               '- Offline IBM.ServiceIP:db2ip_x_x_x_x-rs:db2clu2
  • Ajout des relations entre ressources :

Instance dépend des filesystemes.

#> mkrel -p DependsOn -S IBM.Application:db2_db2inst1_0-rs -G IBM.Application:db2mnt-db2indextext-rs db2_db2inst1_0-rs_DependsOn_db2indextext
#> mkrel -p DependsOn -S IBM.Application:db2_db2inst1_0-rs -G IBM.Application:db2mnt-db2data-rs      db2_db2inst1_0-rs_DependsOn_db2data
  • Relation db2text dépend de l’instance (démarrage après l’instance) :
#> mkrel -p DependsOn -S IBM.Application:db2text-db2inst1-rs -G IBM.Application:db2_db2inst1_0-rs  db2text_db2inst1-rs_DependsOn_db2inst1


Modification de l'IP Virtuel

$> db2haicu
Welcome to the DB2 High Availability Instance Configuration Utility (db2haicu).

You can find detailed diagnostic information in the DB2 server diagnostic log file called db2diag.log. Also, you can use the utility called  db2pd to query the status of the cluster domains you create.

For more information about configuring your clustered environment using db2haicu, see the topic called 'DB2 High Availability Instance  Configuration Utility (db2haicu)' in the DB2 Information Center.

db2haicu determined the current DB2 database manager instance is db2inst1. The cluster configuration that follows will apply to this instance.

db2haicu is collecting information on your current setup. This step may take some time as db2haicu will need to activate all databases for the instance to discover all paths ...
When you use db2haicu to configure your clustered environment, you create cluster domains. For more information, see the topic 'Creating a  cluster domain with db2haicu' in the DB2 Information Center. db2haicu is searching the current machine for an existing active cluster domain  ...
db2haicu found a cluster domain called db2clu on this machine. The cluster configuration that follows will apply to this domain.

Either db2haicu could not resolve the mount point  or the mount point  is on a file system that is not eligible to be added to the cluster.
Select an administrative task by number from the list below:
 1. Add or remove cluster nodes.
 2. Add or remove a network interface.
 3. Add or remove a highly available database.
 4. Add or remove a mount point.
 5. Add or remove an IP address.
 6. Add or remove a non-critical path.
 7. Move DB2 database partitions and HADR databases for scheduled maintenance.
 8. Change failover policy for this instance.
 9. Create a new quorum device for the domain.
 10. Destroy the domain.
 11. Exit.
Enter your selection:
5
Do you want to add or remove IP addresses to or from the cluster? [1]
1. Add
2. Remove
2
Enter the virtual IP address to be removed from the cluster:
x.x.x.x
Are you sure you want to remove the virtual IP address x.x.x.x from the cluster? [2]
1. Yes
2. No
1
Removing virtual IP address x.x.x.x from the cluster ...
Removing virtual IP address x.x.x.x from the cluster was successful.
Do you want to remove another virtual IP address from the domain? [1]
1. Yes
2. No
2
Do you want to make any other changes to the cluster configuration? [1]
1. Yes
2. No
1
Select an administrative task by number from the list below:
 1. Add or remove cluster nodes.
 2. Add or remove a network interface.
 3. Add or remove a highly available database.
 4. Add or remove a mount point.
 5. Add or remove an IP address.
 6. Add or remove a non-critical path.
 7. Move DB2 database partitions and HADR databases for scheduled maintenance.
 8. Change failover policy for this instance.
 9. Create a new quorum device for the domain.
 10. Destroy the domain.
 11. Exit.
Enter your selection:
5
Do you want to add or remove IP addresses to or from the cluster? [1]
1. Add
2. Remove
1
Enter the virtual IP address:
x.x.x.Xx
Enter the subnet mask for the virtual IP address x.x.x.x: [255.255.255.0]
X.X.X.X
Select the network for the virtual IP x.x.x.x:
1. db2_public_network_0
Enter selection:
1
Adding virtual IP address x.x.x.x to the domain ...
Adding virtual IP address x.x.x.x to the domain was successful.
Do you want to add another virtual IP address? [1]
1. Yes
2. No
2
Do you want to make any other changes to the cluster configuration? [1]
1. Yes
2. No
2
All cluster configurations have been completed successfully. db2haicu exiting ...

Importer une configuration cluster TSA via fichier XML

  • En tant que db2inst1 :
$> db2haicu -f /tmp/confClusterTSA.xml
  • Exemple fichier XML :
 <?xml version="1.0" encoding="UTF-8"?>
  <!-- ================================================================= -->
  <!-- = DB2 High Availability configuration schema                    = -->
  <!-- = Schema describes the elements of DB2 High Availability        = -->
  <!-- = that are used in the configuration of a HA cluster            = -->
  <!-- ================================================================= -->
 <DB2Cluster xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="db2ha.xsd" clusterManagerName="TSA" version="1.0">
  <!-- ================================================================= -->
  <!-- = ClusterDomain element                                           = -->
  <!-- = This element encapsulates the cluster configuration           = -->
  <!-- = specification                                                 = -->
  <!-- = Creating cluster domain of name db2HAdomain                   = -->
  <!-- = Creating an IP quorum device (IP 19.126.4.5)                  = -->
  <!-- = The IP must be pingable at all times by each of the nodes in  = -->
  <!-- = the cluster domain                                            = -->
  <!-- ================================================================= -->
  <ClusterDomain domainName="db2clu">
     <Quorum quorumDeviceProtocol="network" quorumDeviceName="X.X.X.X"/>
  <!-- ================================================================= -->
  <!-- = Physical network element                                      = -->
  <!-- = The physical network specifies the network type, protocol     = -->
  <!-- = IP address, subnet mask, and NIC name                         = -->
  <!-- = Create network of name db2_public_network_0                   = -->
  <!-- ================================================================= -->
     <PhysicalNetwork physicalNetworkName="db2_public_network_0" physicalNetworkProtocol="ip">
      <Interface interfaceName="bond0" clusterNodeName="db2clu1">
        <IPAddress baseAddress="X.X.X.X" subnetMask="255.255.255.0" networkName="db2_public_network_0"/>
      </Interface>
      <Interface interfaceName="bond0" clusterNodeName="db2clu2">
        <IPAddress baseAddress="X.X.X.X" subnetMask="255.255.255.0" networkName="db2_public_network_0"/>
      </Interface>
     </PhysicalNetwork>
  <!-- ================================================================= -->
  <!-- = ClusterNodeName element                                       = -->
  <!-- = The set of nodes in the cluster domain                        = -->
  <!-- ================================================================= -->
     <ClusterNode clusterNodeName="db2clu1"/>
     <ClusterNode clusterNodeName="db2clu2"/>
  </ClusterDomain>
  <!-- ================================================================= -->
  <!-- = Failover policy element                                       = -->
  <!-- = The failover policy specifies the failover order of the       = -->
  <!-- = cluster nodes                                                 = -->
  <!-- = In the current sample the failover policy is mutual take over = -->
  <!-- ================================================================= -->
  <FailoverPolicy>
     <Mutual></Mutual>
  </FailoverPolicy>
  <!-- ================================================================= -->
  <!-- = DB2 Partition element                                         = -->
  <!-- = The DB2 partition type specifies a DB2 Instance Name,         = -->
  <!-- = partition number, virtual IP address, Subnet mask,            = -->
  <!-- = mount resource and the                                        = -->
  <!-- = mutual failover nodes                                         = -->
  <!-- ================================================================= -->
  <DB2PartitionSet>
    <DB2Partition dbpartitionnum="0" instanceName="db2inst1">
       <VirtualIPAddress baseAddress="X.X.X.X" subnetMask="255.255.255.0" networkName="db2_public_network_0"/>
       <Mount filesystemPath="/db2data" />
       <Mount filesystemPath="/db2indextext" />
       <MutualPair systemPairNode1="db2clu1" systemPairNode2="db2clu2" />
    </DB2Partition>
  </DB2PartitionSet>
 </DB2Cluster>

Testes de bascule

Bascule manuel

Bascule sur noeud 2.

En tant que root :

#> rgreq -o move db2_db2inst1_0-rg

Stop du ressource groupe :

#> rgreq -o stop db2_db2inst1_0-rg

Start du ressource groupe :

#> rgreq -o start db2_db2inst1_0-rg

Commandes utiles

  • Liste les ressources groupes :
#> lssam
Online IBM.ResourceGroup:db2_db2inst1_0-rg Nominal=Online
       |- Online IBM.Application:db2_db2inst1_0-rs
               |- Online IBM.Application:db2_db2inst1_0-rs:db2clu1
               '- Offline IBM.Application:db2_db2inst1_0-rs:db2clu2
       |- Online IBM.Application:db2mnt-db2data-rs
               |- Online IBM.Application:db2mnt-db2data-rs:db2clu1
               '- Offline IBM.Application:db2mnt-db2data-rs:db2clu2
       |- Online IBM.Application:db2mnt-db2indextext-rs
               |- Online IBM.Application:db2mnt-db2indextext-rs:db2clu1
               '- Offline IBM.Application:db2mnt-db2indextext-rs:db2clu2
       |- Online IBM.Application:db2mnt-db2instance-rs
               |- Online IBM.Application:db2mnt-db2instance-rs:db2clu1
               '- Offline IBM.Application:db2mnt-db2instance-rs:db2clu2
       '- Online IBM.ServiceIP:db2ip_x_x_x_x-rs
               |- Online IBM.ServiceIP:db2ip_x_x_x_x-rs:db2clu1
               '- Offline IBM.ServiceIP:db2ip_x_x_x_x-rs:db2clu2
  • Afficher le status DB2 HA :

Sous le compte db2inst1.

$> db2pd -ha
           DB2 HA Status
Instance Information:
Instance Name                  = db2inst1
Number Of Domains              = 1
Number Of RGs for instance     = 1

Domain Information:
Domain Name                    = db2clu
Cluster Version                = 2.5.3.3
Cluster State                  = Online
Number of nodes                = 2

Node Information:
Node Name                     State
---------------------         -------------------
db2clu1                  Online
db2clu2                  Online

Resource Group Information:
Resource Group Name            = db2_db2inst1_0-rg
Resource Group LockState       = Unlocked
Resource Group OpState         = Online
Resource Group Nominal OpState = Online
Number of Group Resources      = 5
Number of Allowed Nodes        = 2
  Allowed Nodes
  -------------
  db2clu1
  db2clu2
...
  • Affiche la liste des actions définie des ressources (ou classes)
#> lsactdef
  • Affiche les attributs et valeurs des ressources :
#> lsrsrc -Ab IBM.AgFileSystem | less
#> lsrsrc -Ab IBM.Disk
  • Affiche le domaine :
#> lsrpdomain
Name        OpState RSCTActiveVersion MixedVersions TSPort GSPort
db2clu Online  2.5.3.3           No            12347  12348
  • Affiche les noeuds :
#> lsrpnode
Name         OpState RSCTVersion
db2clu1 Online  2.5.3.3
db2clu2 Online  2.5.3.3
  • Creer une ressource
#> mkrsrc IBM.Application Name="db2text-db2inst1-rs" MonitorCommand="/usr/sbin/rsct/sapolicies/db2/db2text_monitor.ksh db2inst1" StopCommand="/usr/sbin/rsct/sapolicies/db2/db2text_stop.ksh db2inst1" StartCommand="/usr/sbin/rsct/sapolicies/db2/db2text_start.ksh db2inst1" MonitorCommandPeriod=10 MonitorCommandTimeout=120 StopCommandTimeout=330 StartCommandTimeout=600 UserName="root" NodeNameList="{'db2clu1','db2clu2'}"
  • Ajouter une ressource dans un ressource groupe
#> addrgmbr -g db2_db2inst1_0-rg IBM.Application:db2text-db2inst1-rs
  • Supprimer une ressource du ressource groupe
#> rmrgmbr IBM.Application:db2text-db2inst1-rs
  • Créer des relations entre les ressources
#> mkrel -p DependsOn -S IBM.Application:db2_db2inst1_0-rs -G IBM.Application:db2mnt-db2indextext-rs db2_db2inst1_0-rs_DependsOn_db2indextext
#> mkrel -p DependsOn -S IBM.Application:db2_db2inst1_0-rs -G IBM.Application:db2mnt-db2data-rs      db2_db2inst1_0-rs_DependsOn_db2data
#> mkrel -p DependsOn -S IBM.Application:db2text-db2inst1-rs -G IBM.Application:db2_db2inst1_0-rs  db2text_db2inst1-rs_DependsOn_db2inst1
  • Change les attributs récursivemnet
#> chrg -o offline db2_db2inst1_0-rg
#> chrg -o online db2_db2inst1_0-rg
  • Stoppe le ressource groupe
#> stoprsrc -s "Name=='db2_db2inst1_0-rs'" IBM.Application
  • Start le ressource groupe
#> startrsrc -s "Name=='db2_db2inst1_0-rs'" IBM.Application
  • Mettre online le ressource groupe
#> chrg -o online db2_db2inst1_0-rg
  • Mettre offline le ressource groupe
#> chrg -o offline db2_db2inst1_0-rg
  • Afficher les informations d'une ressource :
#> lsrsrc -s "Name like 'db2ip%'" IBM.Application | more
#> lsrsrc -s "Name like 'db2ip%'" IBM.ServiceIP | more
  • Affiche les relations existantes du ressource groupe :
#> lsrel
Displaying Managed Relations :

Name                                                  Class:Resource:Node[Source]         ResourceGroup[Source]
db2_db2inst1_0-rs_DependsOn_db2_public_network_0-rel  IBM.Application:db2_db2inst1_0-rs   db2_db2inst1_0-rg
db2_db2inst1_0-rs_DependsOn_db2data                   IBM.Application:db2_db2inst1_0-rs   db2_db2inst1_0-rg
...
  • Stop une ressource (ex db2text)
#> rgmbrreq -o stop IBM.Application:db2text-db2inst1-rs


  • Annule la commande stop d'une ressource (ex db2text)
#> rgmbrreq -o cancel IBM.Application:db2text-db2inst1-rs

Suite a cette commade le cluster démarrera db2text et donc online...

  • Supprimer la configuration cluster TSA :

En tant que db2inst1

$>db2haicu -delete
  • Désactiver le cluster
#> chrg -o offline db2_db2inst1_0-rg
#> stoprpdomain db2clu
  • Activer le cluster
#> startrpdomain db2clu
#> lsrpdomain
#> lsrpnode
#> chrg -o online db2_db2inst1_0-rg

Fichiers utiles

  • sapolicies db2
#> ls -la /usr/sbin/rsct/sapolicies/db2/

Fichier de monitor, stop, start des ressouces.

  • LOG TSA

/var/ct/db2clu/log/mc/IBM.RecoveryRM

Lire :

#> rpttr -f trace_summary

Problématique rencontré

  • le nom des nodes doit être identique au nom affiché avec la commande hostname !

Sinon msg d'erreur au niveau des points de montage...

Either db2haicu could not resolve the mount point /db2instance or the mount point /db2instance is on a file system that is not eligible to be added to the cluster.
and when trying to add "manually" (by db2haicu > add or remove mount point > Add) a mount point it is the same error.

Doc supplémentaire

File:Db2 db2haicu.pdf