WebSphere Message Broker バージョン 8.0.0.5 オペレーティング・システム: AIX、HP-Itanium、Linux、Solaris、Windows、z/OS

製品の最新バージョンについては、IBM Integration Bus バージョン 9.0 をご覧ください。

ブローカーと既存の高可用性マネージャーの併用

WebSphere® Message Broker バージョン 8.0 と既存の高可用性マネージャー (HACMP™、 HA/XD、VCS、または HP-UX Serviceguard など) を併用できます。

WebSphere Message Broker バージョン 7.0 でのマルチインスタンス・メッセージ・ブローカーの導入によって、WebSphere Message Broker バージョン 8.0 と高可用性 (HA) マネージャーを併用するための構成が非常に容易になりました。 以前は、この要件の構成に役立つサポート・パック IC91 が用意されていました。

いくつかのスクリプトが用意されていましたが、そのほとんどは、マルチインスタンスの作業によって多数の関数が WebSphere Message Broker バージョン 8.0 に組み込まれた結果、不要になりました。

このトピックは、以下のタスクを完了する方法を要約しています。
  1. ブローカーの作成。
  2. ブローカー・インスタンスの追加。
  3. ブローカーの開始。
  4. ブローカーの停止。
  5. ブローカーのモニター。
  6. ブローカーの削除。
  1. ブローカーを作成するには、共有リソースを 1 次ノードにマウントし、以下のように mqsicreatebroker コマンドに -e パラメーターを使用してその共有リソースの場所を指定します。
     mqsicreatebroker MyBroker -q MQ1 -e /MQHA/MyBroker/
    ここで、
    • MyBroker は、ブローカーの名前です。
    • MQ1 は、キュー・マネージャーの名前です。
    • /MQHA/MyBroker/ は、共有リソースのディレクトリーです。
  2. 別のブローカー・インスタンスを追加するには、共有リソースを 2 次ノードにマウントし、次の mqsiaddbrokerinstance コマンドを使用します。
     mqsiaddbrokerinstance MyBroker –e /MQHA/MyBroker/
    ここで、
    • MyBroker は、ブローカーの名前です。
    • /MQHA/MyBroker/ は、共有リソースのディレクトリーです。
  3. ブローカーを開始するには、以下のいずれかのスクリプト・ファイルを使用できます。
    hamqsi_start_broker
    #!/bin/ksh
    # Module:
    #   hamqsi_start_broker
    #
    # Args:
    #   BROKER = name of broker to start
    #
    # Description:
    #   This script attempts to start the MQSI Broker
    #
    #   Runs as the userid which runs broker, and must have 
    #   the user's environment (i.e. invoke from "su - $MQUSER ..")
    #
    
    BROKER=$1
    
    if [ -z "$BROKER" ]
    then
      echo "hamqsi_start_broker: ERROR! No Broker name supplied"
      echo "   Usage: hamqsi_start_broker <BROKER>" 
      exit 1
    fi
    
    # Ensure that the broker is not already running. In this test
    # we look for any broker-related processes, which might have
    # been left around after a previous failure. Any that remain
    # must now be terminated. This is a brutal means of mopping 
    # up broker processes.
    # We stop the processes in the following order:
    #   bipservice       - first so it cannot issue restarts
    #   bipbroker        - next for same reason
    #   biphttplistener
    #   startDataFlowEngine
    #   DataFlowEngine  - last
    #
    echo "hamqsi_start_broker: Ensure $BROKER not already running"
    for process in bipservice bipbroker biphttplistener startDataFlowEngine
    DataFlowEngine
    do
      # Output of kill redirected to /dev/null in case no processes
      ps -ef | grep "$process $BROKER" | grep -v grep | ¥
         awk '{print $2}'| xargs kill -9 > /dev/null 2>&1
    done
    
    
    # Start the Broker 
    echo "hamqsi_start_broker: Start Broker " $BROKER
    mqsistart $BROKER > /dev/null 2>&1
    if [ $? -ne "0" ]
    then 
      echo "hamqsi_start_broker: Bad result from mqsistart for $BROKER"
      exit 1
    fi
    
    # Check to see if the broker service has started. This loop 
    # uses a fixed online timeout of approx. 10 seconds.
    TIMED_OUT=yes
    i=0
    while [ $i -lt 10 ]
    do
      # Check for Broker start. We look for bipservice and 
      # bipbroker to be running; there might be no message flows
      # deployed.
      # Look to see whether bipservice is running
      cnt=`ps -ef | grep "bipservice $BROKER" | grep -v grep | wc -l`
      if [ $cnt -gt 0 ]
      then
        # Look to see whether bipbroker is running
        cnt=`ps -ef | grep "bipbroker $BROKER" | grep -v grep | wc -l`
        if [ $cnt -gt 0 ]
        then
          # Broker is online
          echo "hamqsi_start_broker: ${BROKER} is running"
          TIMED_OUT=no
          break  # out of timing loop
        fi
      fi
      # Manage the loop counter
      i=`expr $i + 1`
      sleep 1
    done
    
    # Report error if broker failed to start in time
    if [ ${TIMED_OUT} = "yes" ]
    then 
      echo "hamqsi_start_broker: Broker service failed to start: " $BROKER
      exit 1
    fi
    
    exit 0
    hamqsi_start_broker_as
    #
    #!/bin/ksh
    # Module:
    #   hamqsi_start_broker_as
    #
    # Args:
    #   broker = broker name
    #   qm     = name of broker queue manager
    #   mquser = user account under which QM and Broker are run
    #
    # Description:
    #   Starting an MQSI Broker requires the following services:
    #   (1) The MQSeries Queue Manager which supports the Broker  
    #   (2) The MQSI Broker service 
    #   This script provides a single source to initiate the required 
    #   services in sequence. 
    #  
    #   Queue Manager:
    #   This script uses the strmqm script supplied by MQSeries V7
    #  
    #   Broker:
    #   This script then invokes the hamqsi_start_broker script which 
    #   checks that the broker is fully stopped and then starts it.
    #
    #   The hamqsi_start_broker_as script should be run as root.
    
    
    
    # Check running as root
    if [ `id -u`  -ne 0 ]
    then
      echo "Must be running as root"
      exit 1
    fi
    
     
    BROKER=$1
    QM=$2
    MQUSER=$3
    
    # Check all parameters exist
    
    if [ -z "$BROKER" ]
    then
      echo "hamqsi_start_broker_as: ERROR! No Broker name supplied"
      echo "  Usage: hamqsi_start_broker_as <BROKER> <QM> <MQUSER>"
      exit 1
    fi
    
    if [ -z "$QM" ]
    then
      echo "hamqsi_start_broker_as: ERROR! No queue manager name supplied"
      echo "  Usage: hamqsi_start_broker_as <BROKER> <QM> <MQUSER>"
      exit 1
    fi
    
    if [ -z "$MQUSER" ]
    then
      echo "hamqsi_start_broker_as: ERROR! No Userid supplied"
      echo "  Usage: hamqsi_start_broker_as <BROKER> <QM> <MQUSER>"
      exit 1
    fi
    
    # ------------------------------------------------------------------- 
    # Start the Queue Manager 
    #
    echo "hamqsi_start_broker_as: Start Queue manager " $QM 
    su $MQUSER -c "/opt/mqm/bin/strmqm $QM"
    rc=$?
    if [ $rc -ne 0 ]
    then
      echo "hamqsi_start_broker_as: Could not start the queue manager"
      exit $rc
    fi
    
    # ------------------------------------------------------------------- 
    # Start the Broker
    #
    # Ensure that the Broker is not already running and start the Broker 
    su - $MQUSER -c "/MQHA/bin/hamqsi_start_broker $BROKER"
    rc=$?
    if [ $rc -ne 0 ]
    then
      echo "hamqsi_start_broker_as: Could not start the broker"
      exit $rc
    fi
    
    exit $rc
  4. ブローカーを停止するには、以下のいずれかのスクリプト・ファイルを使用できます。
    hamqsi_stop_broker
    #!/bin/ksh
    # Module:
    #   hamqsi_stop_broker
    #
    # Args:
    #   broker = name of broker
    #   timeout = max time to allow for each phase of termination
    #
    # Description:
    #   This script stops the broker, forcibly if necessary.
    #   The script should be run by the user account under which 
    #   the broker is run, including environment. 
    
    BROKER=$1
    TIMEOUT=$2
    
    if [ -z "$BROKER" ]
    then
      echo "hamqsi_stop_broker: ERROR! No broker name supplied"
      echo "   Usage: hamqsi_stop_broker <BROKER> <TIMEOUT>"
      exit 1
    fi
    
    if [ -z "$TIMEOUT" ]
    then
      echo "hamqsi_stop_broker: ERROR! No timeout supplied"
      echo "   Usage: hamqsi_stop_broker <BROKER> <TIMEOUT>"
      exit 1
    fi
    
    for severity in normal immediate terminate
    do
      # Issue the stop method in the background - we don't
      # want to risk having it hang us up, indefinitely. We
      # want to be able to concurrently run a TIMEOUT timer
      # to give up on the attempt, and try a more forceful 
      # stop. If the kill version fails then there is nothing 
      # more we can do here anyway.
      
      echo "hamqsi_stop_broker: Attempting ${severity} stop of ${BROKER}"
      case $severity in
    
      normal)
        # Minimum severity of stop is to issue mqsistop
        mqsistop $BROKER > /dev/null 2>&1 &
        ;;
    
      immediate)
        # This is an immediate stop.
        mqsistop $BROKER -i > /dev/null 2>&1 &
        ;;
    
      terminate)
        # This is a brutal means of mopping up Broker processes.
        # We stop the processes in the following order:
        #   bipservice       - first so it cannot issue restarts
        #   bipbroker        - next for same reason
        #   biphttplistener
        #   startDataFlowEngine
        #   DataFlowEngine  - last
        for process in bipservice bipbroker biphttplistener startDataFlowEngine
        DataFlowEngine 
        do
          # Output of kill redirected to /dev/null in case no processes
          ps -ef | grep "$process $BROKER" | grep -v grep | ¥
            awk '{print $2}'| xargs kill -9 > /dev/null 2>&1
        done
        ;;
    
      esac
    
      echo "hamqsi_stop_broker: Waiting for ${severity} stop of ${BROKER} to complete"
      TIMED_OUT=yes
      SECONDS=0
      while (( $SECONDS < ${TIMEOUT} ))
      do
        # See whether there are any broker processes still running 
        cnt=`ps -ef | ¥
          grep -E "bipservice $BROKER|bipbroker $BROKER|startDataFlowEngine 
          $BROKER|DataFlowEngine $BROKER|biphttplistener $BROKER" | \
          grep -v grep | wc -l`
        if [ $cnt -gt 0 ]
        then
          # It's still running...wait for timeout
          sleep 1 # loop granularity
        else
          # It's stopped, as desired
          echo "${BROKER} has stopped"
          TIMED_OUT=no
          break # out of while ..offline timeout loop
        fi
      done # timeout loop
    
      if [ ${TIMED_OUT} = "yes" ]
      then
        continue        # to next level of urgency
      else
        break           # instance is stopped, job is done
      fi
    
    done # next level of urgency
    
    if [ ${TIMED_OUT} = "no" ]
    then
      echo "hamqsi_stop_broker: Completed"
      exit 0
    else
      echo "hamqsi_stop_broker: Completed with errors"
      exit 1
    fi 
    hamqsi_stop_broker_as
    #!/bin/ksh
    # Module:
    #   hamqsi_stop_broker_as
    #
    # Arguments are:
    #   broker = name of broker 
    #   qm     = name of broker queue manager
    #   mquser = user account under which QM and broker run
    #   timeout = max time to allow each phase of stop processing
    #
    # Description:
    #   This script stops the Broker, Queue Manager in that sequence.
    #  
    #   Broker:
    #   The script invokes the hamqsi_stop_broker script to stop the 
    #   broker, which checks that the broker is fully stopped.
    #  
    #   Queue Manager:
    #   This script uses the strmqm script supplied by MQSeries V7 
    #  
    #   The hamqsi_stop_broker_as script should be run as root. 
    
    
    # Check running as root
    if [ `id -u`  -ne 0 ]
    then
      echo "Must be running as root"
      exit 1
    fi
    
     
    BROKER=$1
    QM=$2
    MQUSER=$3
    TIMEOUT=$4
    
    # Check all parameters
    
    if [ -z "$BROKER" ]
    then
      echo "hamqsi_stop_broker_as: ERROR! No Broker name supplied"
      echo "   Usage: hamqsi_stop_broker_as <BROKER> <QM> <MQUSER> <TIMEOUT>"
      exit 1
    fi
    
    if [ -z "$QM" ]
    then
      echo "hamqsi_stop_broker_as: ERROR! No queue manager name supplied"
      echo "   Usage: hamqsi_stop_broker_as <BROKER> <QM> <MQUSER> <TIMEOUT>"
      exit 1
    fi
    
    if [ -z "$MQUSER" ]
    then
      echo "hamqsi_stop_broker_as: ERROR! No userid supplied"
      echo "   Usage: hamqsi_stop_broker_as <BROKER> <QM> <MQUSER> <TIMEOUT>"
      exit 1
    fi
    
    if [ -z "$TIMEOUT" ]
    then
      echo "hamsi_stop_broker_as: ERROR! No Timeout value supplied"
      echo "   Usage: hamqsi_stop_broker_as <BROKER> <QM> <MQUSER> <TIMEOUT>"
     exit 1
    fi
    
    
    METHOD_STATUS="OK"
    
    # ------------------------------------------------------------------- 
    # Stop the BROKER
    #
    echo "hamqsi_stop_broker_as: Stop Broker " $BROKER
    su - $MQUSER -c "/MQHA/bin/hamqsi_stop_broker $BROKER $TIMEOUT"
    if [ $? -ne "0" ]
    then
      # Even if the above operation failed, just report and then continue by 
      # stopping other components
      echo "hamqsi_stop_broker_as: Attempt to stop broker $BROKER failed"
      METHOD_STATUS="Error"
    fi
    
    # ------------------------------------------------------------------- 
    # Stop the Queue Manager, using script from MQ V7
    #
    echo "hamqsi_stop_broker_as: Stop Queue Manager $QM"
    su $MQUSER -c "/opt/mqm/bin/endmqm -i $QM"
    if [ $? -ne "0" ]
    then
      # Even if the above operation failed, just report and then continue by 
      # stopping other components
      echo "hamqsi_stop_broker_as: Attempt to stop queue manager $QM failed"
      METHOD_STATUS="Error"
    fi
    
    if [ ${METHOD_STATUS} = "OK" ]
    then
      exit 0
    else
      echo "hamqsi_stop_broker_as: Completed with errors"
      exit 1
    fi
  5. ブローカーをモニターするには、以下のスクリプト・ファイルを使用します。メインのブローカー・プロセスの存在だけを検査し、見つかった場合に成功の戻りコードを返すスクリプト・ファイルです。
    hamqsi_monitor_broker_as
    #!/bin/ksh
    # Module:
    #   hamqsi_monitor_broker_as
    #
    # Args:
    #   BROKER = name of broker in AppServer
    #   QM     = name of queue manager in AppServer
    #   MQUSER = userid under which queue manager and broker run
    # 
    # Description:
    #   This is the application monitor script used with HACMP/ES. It 
    #   needs to be invoked by a parameter-less wrapper script because
    #   HACMP does not allow parameters to be passed to application
    #   monitor scripts.
    #  
    #   This hamqsi_monitor_broker_as script is run as root, and uses 
    #   su as needed to monitor the 3 components of the application server.
    #  
    #   This script is tolerant of a queue manager that is still in
    #   startup. If the queue manager is still starting this application 
    #   monitor script will exit with 0 - which indicates
    #   to HACMP that there's nothing wrong. This is to allow for
    #   startup time for the queue manager which might exceed the 
    #   Stabilisation Interval set for the Application Monitor in HACMP/ES.
    #    
    #  
    # Exit codes:
    #   0  => Broker & QM are all running OK or starting
    #   >0 => One or more components are not responding.
    #
    
    # Check running as root
    if [ `id -u`  -ne 0 ]
    then
      echo "Must be running as root"
      exit 1
    fi
    
    BROKER=$1
    QM=$2
    MQUSER=$3
    
    # Check the parameters
    
    if [ -z "$BROKER" ]
    then
      echo "hamqsi_monitor_broker_as: ERROR! No broker name supplied"
      exit 1
    fi
    
    if [ -z "$QM" ]
    then
      echo "hamqsi_monitor_broker_as: ERROR! No queue manager name supplied"
      exit 1
    fi
    
    if [ -z "$MQUSER" ]
    then
      echo "hamqsi_monitor_broker_as: ERROR! No mquser supplied"
      exit 1
    fi
    
    # Use a state variable to reflect the state of components as they
    # are tested. Valid values are "stopped", "starting" and "started"
    # Initialise it to "stopped" for safety. 
    STATE="stopped"
    
    # ------------------------------------------------------------------
    # Check that the queue manager is running or starting.
    #
    su - $MQUSER -c "echo 'ping qmgr' | runmqsc ${QM}" > /dev/null 2>&1
    pingresult=$?
    # pingresult will be 0 on success; non-zero on error (man runmqsc)
    if [ $pingresult -eq 0 ]
    then 
      # ping succeeded
      echo "hamqsi_monitor_broker_as: Queue Manager ${QM} is responsive"
      STATE="started"
    else 
      # ping failed
      # Don't condemn the QM immediately, it might be in startup.
      # The following regexp includes a space and a tab, so use tab-friendly
      # editors.
      srchstr=" $QM[  ]*$"
      cnt=`ps -ef | grep strmqm | grep "$srchstr" | grep -v grep ¥
                    | awk '{print $2}' | wc -l`
      if [ $cnt -gt 0 ]
      then
        # It appears that QM is still starting up, tolerate
        echo "hamqsi_monitor_broker_as: Queue Manager ${QM} is starting"
        STATE="starting"
      else
        # There is no sign of QM start process
        echo "hamqsi_monitor_broker_as: Queue Manager ${QM} is not responsive"
        STATE="stopped"
      fi
    fi
    
    
    # Decide whether to continue or to exit
    case $STATE in
      stopped)
        echo "hamqsi_monitor_broker_as: Queue manager ($QM) is not running correctly"
        exit 1  
        ;;
      starting)
        echo "hamqsi_monitor_broker_as: Queue manager ($QM) is starting"
        echo "hamqsi_monitor_broker_as: WARNING - Stabilisation Interval might be too short"
        echo "hamqsi_monitor_broker_as: WARNING - No test of broker $BROKER will be conducted"
        exit 0  
        ;;
      started)
        echo "hamqsi_monitor_broker_as: Queue manager ($QM) is running"
        continue 
        ;;
    esac
    
    # ------------------------------------------------------------------
    # Check the MQSI Broker is running 
    # 
    # Re-initialise STATE for safety
    STATE="stopped"
    #
    # The broker runs as a process called bipservice which is responsible
    # for starting and re-starting the admin agent process (bipbroker). 
    # The bipbroker is responsible for starting any DataFlowEngines. The 
    # bipbroker starts the DataFlowEngines using the wrapper script 
    # startDataFlowEngine. If no execution groups have been assigned to 
    # the broker there will be no DataFlowEngine processes. There should 
    # always be a bipservice and bipbroker process pair. This monitor 
    # script only tests for bipservice, because bipservice should restart 
    # bipbroker if necessary - the monitor script should not attempt to 
    # restart bipbroker and it might be premature to report an absence 
    # of a bipbroker as a failure.
    #
    cnt=`ps -ef | grep "bipservice $BROKER" | grep -v grep | wc -l`
    if [ $cnt -eq 0 ]
    then 
      echo "hamqsi_monitor_broker_as: MQSI Broker $BROKER is not running"
      STATE="stopped"
    else
      echo "hamqsi_monitor_broker_as: MQSI Broker $BROKER is running" 
      STATE="started"
    fi
    
    # Decide how to exit
    case $STATE in
      stopped)
        echo "hamqsi_monitor_broker_as: Broker ($BROKER) is not running correctly"
        exit 1  
        ;;
      started)
        echo "hamqsi_monitor_broker_as: Broker ($BROKER) is running"
        exit 0 
       ;;
    esac 
    前の例よりも多くの情報が必要な場合は、以下の処置を行うように、モニターをコーディングします。
    • WebSphere Message Broker のアカウンティングと統計にサブスクライブして、結果を分析します。
    • ブローカーにダミーのメッセージを流して、結果を分析します。
  6. 1 次ノードでブローカーを削除する前に、待機ノードにあるブローカーを削除する必要があります。 ブローカーを削除するには、2 次ノードで mqsiremovebrokerinstance コマンドを使用し、1 次ノードで mqsideletebroker コマンドを使用します。

WebSphere MQ と高可用性マネージャーを併用するための構成の詳細については、WebSphere MQ バージョン 7 インフォメーション・センター・オンラインを参照してください。

以下の項を参照してください。
  • addmqinf コマンド
  • dspmqinf コマンド
  • rmvmqinf. コマンド
crtmqm コマンドの -md オプションの項も参照してください。
特記事項 | 商標 | ダウンロード | ライブラリー | サポート | フィードバック

Copyright IBM Corporation 1999, 2014Copyright IBM Corporation 1999, 2014.

        
        最終更新:
        
        最終更新: 2015-02-28 17:49:00


タスク・トピックタスク・トピック | バージョン 8.0.0.5 | be13730_