Some utility scripts that are handy when managing pureScale or DPF cluster.

runall scripts

Use runall script to commands on all hosts. This way, it is easier to run commands in a single command rather than to type many different lines.

#!/bin/bash

NODES=/home/db2psc/sqllib/db2nodes.cfg
SSH="/usr/bin/ssh -q -o StrictHostKeyChecking=no"
if [ -f $NODES ] ; then
 servers=$(awk '{print $2}' $NODES)
else
 servers=localhost
fi

for server in $servers
do
 echo Running "$@" on server $server
 $SSH $server "$@"
done

runscp script

Sometime, when you build a golden image for one node and need to copy file to all other hosts, runscp is handy to copy same file on all servers.

#!/bin/bash

NODES="node02 node04 node05 node06 node07"
SCP="/usr/bin/scp -q -o StrictHostKeyChecking=no"

if [[ $# -ne 1 ]] ; then
 echo Usage: runscp fullpathname
 exit 1
fi

file=$1

for server in $NODES
do
 path=${file%/*}
 echo Copying $file to $server
 $SCP $file $server:$path
done

ssh test on cluster

To make sure that password less ssh is working from each host to each other host. The ssh test should be done for short names, FQDN and IP addresses. Change nodes accordingly for short names, FQDN and IP addresses to test for all 3 cases. This solves many pureScale issues that you might come across. Create ip.txt in your home directory. If you want to test for db2 instance user or the db2 ssh user, create ip.txt in the home directory of the user who is running this script.

[root@node01 setup]# cat ip.txt
192.168.100.171 node01.zinox.com node01 
192.168.100.172 node02.zinox.com node02 
192.168.100.173 node03.zinox.com node03 
192.168.100.174 node04.zinox.com node04 

[root@node01 setup]# cat testssh
#!/bin/bash

IPFILE=ip.txt
SSH="/var/db2/db2ssh/db2locssh -o ConnectTimeout=10 -q -o StrictHostKeyChecking=no"

while read a b c
do
 a1[index]=$a
 a2[index]=$b
 a3[index]=$c
 ((index++))
done < $IPFILE

for h1 in ${a1[@]}
do
 for h2 in ${a1[@]}
 do
 echo -n "Testing from $h1 to $h2 "
 $SSH $h1 "$SSH $h2 hostname"
 done
done

for h1 in ${a2[@]}
do
 for h2 in ${a2[@]}
 do
 echo -n "Testing from $h1 to $h2 "
 $SSH $h1 "$SSH $h2 hostname -s"
 done
done

for h1 in ${a3[@]}
do
 for h2 in ${a3[@]}
 do
 echo -n "Testing from $h1 to $h2 "
 $SSH $h1 "$SSH $h2 hostname -s"
 done
done