User Tools

Site Tools


middleware:mq

Websphere MQ

Formerly known as MQ Series

Limits

User

You could need to raise some limits for the mqm user/group. Try with:

@mqm     soft stack  unlimited

in a /etc/security/limits.d/mqm.conf file (see limits.conf man page).

System

You may need to raise some of the kernel limits (i.e. semaphores)

To check for the right values you can use the mqconfig script provided by IBM.

Installing MQ in CentOS

You need some additional libraries:

yum install compat-libstdc++-33-3.2.3-61 libXp

Reason codes

Here's a listo of MQ7 Reason Codes

Recipes

Manage a QM

Start the QM

strmqm <QUEUE_MANAGER>

Stop the QM

endmqm <QUEUE_MANAGER>

List all the defined QMs

dspmq

Start the command line console

runmqsc <QUEUE_MANAGER>

Create a new Queue Manager

Create the QM

crtmqm -u SYSTEM.DEAD.LETTER.QUEUE <QUEUE_MANAGER>

Create channel and listener

Via runmqsc:

DEFINE CHANNEL(<CHANNEL_NAME>) CHLTYPE(SVRCONN) MCAUSER('mqm')
DEFINE LISTENER(<LISTENER_NAME>) TRPTYPE(TCP) CONTROL(QMGR) PORT(141XX)
START LISTENER(<LISTENER_NAME>)

Delete a Queue Manager

endmqm <QUEUE_MANAGER>
dltmqm <QUEUE_MANAGER>

Show used ports

echo "DISPLAY LISTENER(*) PORT" |\
runmqsc <QUEUE_MANAGER>

Show active connections

MQ 6.0

echo "DISPLAY CONN(*) APPLTAG CONNAME" | runmqsc <QUEUE_MANAGER> | grep "APPLTAG"

MQ 5.3

echo "DISPLAY CHSTATUS(*) ALL" | runmqsc <QUEUE_MANAGER> | grep "CONNAME" | cut -f 2 -d "("

Increase the number of channels

Edit qm.ini (in /var/mqm/qmgrs/QM_NAME/) and add the following stanza:

Channels:
  MaxChannels=nn

The default is 100.

Enable TCP Keepalive

Edit `qm.ini` (in `/var/mqm/qmgrs/QUEUE_MANAGER/`) and add the following stanza:

TCP:
  KeepAlive=Yes

Note that TCP keepalive support must be activated at OS/kernel level.

Show QM status

It also shows the total number of active connections.

DISPLAY QMSTATUS ALL

Show the status of a queue

DISPLAY QSTATUS(<QUEUE>)

Configure for publish/subscribe

MQ 6

  • Create the queues for JMS access: runmqsc MYQM < /opt/mqm/java/bin/MQJMS_PSQ.mqsc
  • Start the broker with: strmqbrk -m MYQM

MQ 7

No previous configuration needed. If you want you can create topics with

DEFINE TOPIC(MYTOPIC) TOPICSTR('MyTopicString')

Clean a QM

…excluding the system objects.

With solaris use nawk(1): /usr/xpg4/bin/awk

Empty all the queues

MYQM=MYQUEUEMGR
AWK=awk
echo "DISPLAY QLOCAL(*) WHERE (CURDEPTH GT 0)" |\
  runmqsc $MYQM |\
  $AWK '/QUEUE\(SYSTEM./{next} /QUEUE/{sub("QUEUE","QLOCAL"); print "CLEAR",$1} END {print "END"}' |\
  sed -e "s/(/(\'/" -e "s/)/\')/" |\
  runmqsc $MYQM
...forcing rollback

If you have “stubborn” messages you cannot delete (part of a distributed transaction, and now in-doubt) and you need to force the rollback:

  • Disable the listener
  ALTER LISTENER(LISTENERNAME) TRPTYPE(TCP) CONTROL(MANUAL)
  • Stop and restart QM
  • Rollback the pending transactions
  dspmqtrn -m $MYQM | awk '/^AMQ7056/ {print $4}' |\
    sed 's/\.//' | while read tr ; do
      rsvmqtrn -m $MYQM -b $tr
    done
  • Reenable the listener
  ALTER LISTENER(LISTENERNAME) TRPTYPE(TCP) CONTROL(QMGR)
  • Stop and start QM

Delete all QLOCAL and QALIAS

MYQM=MYQUEUEMGR
AWK=awk
echo "DISPLAY QLOCAL(*)" |\
  runmqsc $MYQM |\
  $AWK '/QUEUE\(SYSTEM./{next} /QUEUE/{sub("QUEUE","QLOCAL"); print "DELETE",$1} END {print "END"}' |\
  sed -e "s/(/(\'/" -e "s/)/\')/" |\
  runmqsc $MYQM
echo "DISPLAY QALIAS(*)" |\
  runmqsc $MYQM |\
  $AWK '/QUEUE\(SYSTEM./{next} /QUEUE/{sub("QUEUE","QALIAS"); print "DELETE",$1} END {print "END"}' |\
  sed -e "s/(/(\'/" -e "s/)/\')/" |\
  runmqsc $MYQM

Distributed Queueing (remote queues)

On QM1

DEFINE QREMOTE(QREM) +
     RNAME(QLOC) +
     RQMNAME(QM2) +
     XMITQ(QM2.XMITQ)
DEFINE QLOCAL(QM2.XMITQ) +
     INITQ(SYSTEM.CHANNEL.INITQ) +
     USAGE (XMITQ) +
     TRIGGER +
     TRIGDATA(QM1.TO.QM2) +
     TRIGTYPE(FIRST)
DEFINE CHANNEL(QM1.TO.QM2) +
     CHLTYPE(SDR) +
     TRPTYPE(TCP) +
     XMITQ(QM2.XMITQ) +
     CONNAME('1.2.3.4(1234)')

On QM2

DEFINE QLOCAL (QLOC)
DEFINE CHANNEL(QM1.TO.QM2) +
     CHLTYPE(RCVR) +
     TRPTYPE(TCP)

Clustering

With clustering basically you automate the creation of the remote queues on the queue managers part of the cluster. For the details see the IBM Queue Manager Clusters manual.

Note that a WMQ cluster isn't a full HA solution, for that you must integrate it with some OS-level clustering system; see Using WebSphere MQ with high availability configurations

Following, a sample of a cluster composed by 3 Queue Managers. In each cluster you should have two QM holding the Full Repository. In the sample those are QM1 and QM2.

In each QM we define a cluster queue; plus we have a Load Balanced queue that is seen globally and that is local only to QM2 and QM3.

On QM1

Local IP is 1.1.1.1

* We hold the Full Repository
ALTER QMGR REPOS(MYCLUSTER)

DEFINE CHANNEL(TO.QM1) CHLTYPE(CLUSRCVR) TRPTYPE(TCP) +
  CONNAME('1.1.1.1(14141)') CLUSTER(MYCLUSTER) +
  DESCR('Cluster-receiver channel for QM1')

DEFINE CHANNEL(TO.QM2) CHLTYPE(CLUSSDR) TRPTYPE(TCP) +
  CONNAME('2.2.2.2(14142)') CLUSTER(MYCLUSTER) +
  DESCR('Cluster-sender channel from QM1 to repository at QM2')

* Cluster Queue
DEFINE QLOCAL(QCLU1) CLUSTER(MYCLUSTER)

On QM2

Local IP is 2.2.2.2

* We hold the Full Repository
ALTER QMGR REPOS(MYCLUSTER)

DEFINE CHANNEL(TO.QM2) CHLTYPE(CLUSRCVR) TRPTYPE(TCP) +
  CONNAME('2.2.2.2(14142)') CLUSTER(MYCLUSTER) +
  DESCR('Cluster-receiver channel for QM2')

DEFINE CHANNEL(TO.QM1) CHLTYPE(CLUSSDR) TRPTYPE(TCP) +
  CONNAME('1.1.1.1(14141)') CLUSTER(MYCLUSTER) +
  DESCR('Cluster-sender channel from QM2 to repository at QM1')

* Cluster Queue
DEFINE QLOCAL(QCLU2) CLUSTER(MYCLUSTER)

* Load balanced queue
DEFINE QLOCAL(QBAL) CLUSTER(MYCLUSTER) CLWLUSEQ(ANY)

On QM3

Local IP is 3.3.3.3

DEFINE CHANNEL(TO.QM3) CHLTYPE(CLUSRCVR) TRPTYPE(TCP) +
  CONNAME('3.3.3.3(14143)') CLUSTER(MYCLUSTER) +
  DESCR('Cluster-receiver channel for QM3')

* We connect to QM1 fo the Full Repository
DEFINE CHANNEL(TO.QM1) CHLTYPE(CLUSSDR) TRPTYPE(TCP) +
  CONNAME('1.1.1.1(14141)') CLUSTER(MYCLUSTER) +
  DESCR('Cluster-sender channel from QM3 to repository at QM1')

* Cluster Queue
DEFINE QLOCAL(QCLU3) CLUSTER(MYCLUSTER)

* Load balanced queue
DEFINE QLOCAL(QBAL) CLUSTER(MYCLUSTER) CLWLUSEQ(ANY)

Start MQ Explorer

Start the graphical Eclipse-based interface with

strmqcfg

Disable channel authentication - MQ 7.5

For a specific channel:

SET CHLAUTH(MYCHANNEL) TYPE(BLOCKUSER) USERLIST('*NOACCESS')

For the whole QM:

ALTER QMGR CHLAUTH(DISABLED)

Useful paths

Configuration files:

/var/mqm/qmgrs/<QUEUE_MANAGER>/qm.ini

Error logs:

/var/mqm/qmgrs/<QUEUE_MANAGER>/errors/AMQ*.LOG
middleware/mq.txt · Last modified: 2016/11/28 10:52 by ap

Informativa sui cookie