WebSphere Message Broker, Versão 8.0.0.5 Sistemas operacionais: AIX, HP-Itanium, Linux, Solaris, Windows, z/OS

Consulte as informações sobre a versão mais recente do produto em IBM Integration Bus, Versão 9.0

Usando um Broker com um Gerenciador de Alta Disponibilidade Existente

É possível usar o WebSphere Message Broker Versão 8.0 com um gerenciador de alta disponibilidade existente, por exemplo, HACMP, HA/XD, VCS ou HP-UX Serviceguard.

Com a introdução de message brokers de múltiplas instâncias no WebSphere Message Broker Versão 7.0, a configuração do WebSphere Message Broker Versão 8.0 com um gerenciador de alta disponibilidade (HA) ficou muito mais fácil. Anteriormente, o pacote de suporte IC91 era fornecido para ajudar na configuração deste requisito.

Vários scripts foram fornecidos, mas a maioria deles não é mais necessária porque o WebSphere Message Broker Versão 8.0 construiu muitas das funções como resultado do trabalho de várias instâncias.

Este tópico resume como concluir as tarefas a seguir:
  1. Criar um broker.
  2. Incluir uma instância do broker.
  3. Iniciar um broker.
  4. Parar um broker.
  5. Monitorar um broker.
  6. Excluir um broker.
  1. Para criar um broker, monte o recurso compartilhado em seu nó primário e use o comando mqsicreatebroker a seguir com o parâmetro -e para especificar seu local de recurso compartilhado.
     mqsicreatebroker MyBroker -q MQ1 -e /MQHA/MyBroker/
    em que:
    • MyBroker é o nome do broker.
    • MQ1 é o nome do gerenciador de filas.
    • /MQHA/MyBroker/ é o diretório para o recurso compartilhado.
  2. Para incluir outra instância do broker, monte o recurso compartilhado em seus nós secundários e use o comando mqsiaddbrokerinstance a seguir.
     mqsiaddbrokerinstance MyBroker –e /MQHA/MyBroker/
    em que:
    • MyBroker é o nome do broker.
    • /MQHA/MyBroker/ é o diretório para o recurso compartilhado.
  3. Para iniciar um broker, é possível usar os seguintes arquivos de script:
    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" ]
    5then
      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 ]
      5then
        # Look to see whether bipbroker is running
        cnt=`ps -ef | grep "bipbroker $BROKER" | grep -v grep | wc -l`
        if [ $cnt -gt 0 ]
        5then
          # 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 ]
    5then
      echo "Must be running as root"
      exit 1
    fi
    
     
    BROKER=$1
    QM=$2
    MQUSER=$3
    
    # Check all parameters exist
    
    if [ -z "$BROKER" ]
    5then
      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" ]
    5then
      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" ]
    5then
      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 ]
    5then
      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 ]
    5then
      echo "hamqsi_start_broker_as: Could not start the broker"
      exit $rc
    fi
    
    exit $rc
  4. Para parar um broker, é possível usar um dos seguintes arquivos de script:
    hamqsi_stop_broker
    #!/bin/ksh
    # Module:
    #   hamqsi_stop_broker
    #
    # Args:
    #   broker = nome do 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" ]
    5then
      echo "hamqsi_stop_broker: ERROR! No broker name supplied"
      echo "   Usage: hamqsi_stop_broker <BROKER> <TIMEOUT>"
      exit 1
    fi
    
    if [ -z "$TIMEOUT" ]
    5then
      echo "hamqsi_stop_broker: ERROR! No timeout supplied"
      echo "   Usage: hamqsi_stop_broker <BROKER> <TIMEOUT>"
      exit 1
    fi
    
    para severidade em encerramento imediato normal
    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 ]
        5then
          # 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" ]
      5then
        continue        # to next level of urgency
      else
        break           # instance is stopped, job is done
      fi
    
    done # next level of urgency
    
    if [ ${TIMED_OUT} = "no" ]
    5then
      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 ]
    5then
      echo "Must be running as root"
      exit 1
    fi
    
     
    BROKER=$1
    QM=$2
    MQUSER=$3
    TIMEOUT=$4
    
    # Check all parameters
    
    if [ -z "$BROKER" ]
    5then
      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" ]
    5then
      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" ]
    5then
      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" ]
    5then
      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" ]
    5then
      # 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" ]
    5then
      # 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" ]
    5then
      exit 0
    else
      echo "hamqsi_stop_broker_as: Completed with errors"
      exit 1
    fi
  5. Para monitorar um broker, é possível usar o seguinte arquivo de script que verifica apenas a existência dos principais processos do broker e fornece um código de retorno bem sucedido se não forem localizados:
    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 ]
    5then
      echo "Must be running as root"
      exit 1
    fi
    
    BROKER=$1
    QM=$2
    MQUSER=$3
    
    # Check the parameters
    
    if [ -z "$BROKER" ]
    5then
      echo "hamqsi_monitor_broker_as: ERROR! No broker name supplied"
      exit 1
    fi
    
    if [ -z "$QM" ]
    5then
      echo "hamqsi_monitor_broker_as: ERROR! No queue manager name supplied"
      exit 1
    fi
    
    if [ -z "$MQUSER" ]
    5then
      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 ]
      5then
        # 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 
    Se precisar de mais informações do que as fornecidas pelo exemplo precedente, será possível codificar seu monitor para executar as seguintes ações:
    • Assine a contabilidade e as estatísticas do WebSphere Message Broker e analise os resultados.
    • Coloque uma mensagem simulada por meio do broker e analise os resultados.
  6. Antes de excluir o broker no nó primário, é necessário excluir quaisquer brokers nos nós de espera. Para excluir um broker, use o comando mqsiremovebrokerinstance nos nós secundários e o comando mqsideletebroker no nó primário.

Para obter informações adicionais sobre como configurar o WebSphere MQ com um gerenciador de alta disponibilidade, consulte Centro de Informações Online do WebSphere MQ Versão 7.

Consulte o:
  • comando addmqinf
  • comando dspmqinf
  • comando rmvmqinf. comando
e a opção -md no comando crtmqm.
Avisos | Marcas Registradas | Downloads | Biblioteca | Suporte | Feedback

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

        
        Última atualização:
        
        Última atualização: 2015-02-28 18:31:15


Tópico de TarefaTópico de Tarefa | Versão 8.0.0.5 | be13730_