免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4725 | 回复: 3
打印 上一主题 下一主题

[HACMP集群] hacmp中db2的进程监控脚本要怎么写? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-07-03 21:11 |只看该作者 |倒序浏览
hacmp中db2的进程监控脚本要怎么写?

Cleanup Method                                     [/ha5.3/stop.sh]
Restart Method                                     [/ha5.3/start.sh]

上面的两个地方还要用db2的启动和关闭脚本吗

还有就是
* Action on Application Failure                      [notify]                                    +
  Notify Method                                      []

怎么写?

论坛徽章:
0
2 [报告]
发表于 2008-07-03 23:22 |只看该作者
如果双机不是MPP的话很简单
db2start
db2stop force
sleep 60-120(或者再加一个进程判断)
db2_kill(我一般会加这句,保证系统ipcs干净。DB2比较健壮,很少因为kill而掉数据。)

如果是MPP的话比较复杂,要分别处理节点,在处理0号节点时候会特殊点
而且需要花很大的力气在处理nfs上(一般home目录是用nfs挂的,用gpfs的可以略过)

监控的话,DB2自带进程监控,db2fmcd,但好像不太好用,我都是直接写脚本监控db2sysc X

论坛徽章:
0
3 [报告]
发表于 2008-07-04 14:37 |只看该作者
#!/bin/sh
# -*- mode: shell-script; -*-
# $Id: $
#
# Copyright 2005 Vision Solutions, Inc.
#
# db2_heartbeat -- This script will check if db2 is running
#
# Usage: db2_heartbeat
#
# This script checks to see if db2 is running.  It assumes that it is
# not there if there has not been a response in 3 seconds.  This script
# can be run by any user, as the correct environment is set internally
# to this script.
#
# This script will end with an exit status of 0 if it runs
# successfully.  In all other circumstances the script will end
# with a non-zero exit status.

# Setup
cmdname=`basename $0`
directory=`dirname $0`

PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
export PATH

# Useful functions.

function usage {
    die "usage: $cmdname [ -p partition ] [ -i db2instname ]

Check to see if the db2 is running.  

The partition number must be an integer or a comma separated
list of integers (e.g., 0,1,2).  There can be no spaces in the
list.  Note that the exit value will be the value of the
partition with the most error.  That is, if partition 0 is
available and partition 1 is not available then checking
partitions 0 and 1 will result in an exit code of \"1\".  

The instance name can be passed in the environment variable
DB2_IUSER.  If DB2_IUSER is set then the -i option is not
needed.  Otherwise, it is required.

If all checked partitions are available exit with 0, if not exit
with 1."
}

function die  { warn "$@"; exit 1; }
function warn { echo "$@" >&2; }

####################################################################
#
# Start Here
#
####################################################################

# The default partition number is 0. If partition is set then
# that partition is checked.

partition=0
while getopts p:i: opt; do
    case "$opt" in
        p)  partition="$OPTARG"        ;;
        i)  export DB2_IUSER="$OPTARG" ;;
        ?)  usage                      ;;
    esac
done
shift `expr $OPTIND - 1`

# DB2_IUSER can come from the environment or from the command line
# But it must be set one way or the other.
[ -z "$DB2_IUSER" ] && usage

eval db2gcf=~"$DB2_IUSER"/sqllib/bin/db2gcf

[ -x "$db2gcf" ] || exit 1

eval $db2gcf -s -p $partition -i $DB2_IUSER >/dev/null 2>&1

#

论坛徽章:
0
4 [报告]
发表于 2008-07-05 14:10 |只看该作者
thanks !
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP