Install IBM WebSphere MQ 5.3 for Linux
Overview
This document contains a procedure for downloading, installing, and testing MQ 5.3 for Linux.
Procedure
- Verify there is at least 160 MB of temporary space
- Server, client, and sample files will occupy approximately 50 MB of space in /opt/mqm.
- Message queue log and error messages are written to /var/mqm. Note that /var/mqm can fill to 100% on occassions of log files grow too large, so be sure to monitor available space.
- Create groups mqm and mqbrkrs.
# groupadd mqm
# groupadd mqbrkrs- Create user mqm. Make the home directory /var/mqm.
# useradd -c"MQ Messaging" -d/var/mqm -g 501 -G mqbrkrs mqm
# passwd mqm
Changing password for user mqm.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.- Add the root user to both the mqm and mqbrkrs groups by editing /etc/group.
mqm:x:501:mqm,root
mqbrkrs:x:502:mqm,root- Log off and then log back on to instantiate new settings.
- Download install binaries
- Untar with: tar xvf filename.tar
- Peruse the readme file
- Configure the license:
# ./mqlicense.sh- Load the server RPMs
# rpm -U MQSeriesRuntime-5.3.0-1.i386.rpm
# rpm -U MQSeriesSDK-5.3.0-1.i386.rpm
# rpm -U MQSeriesServer-5.3.0-1.i386.rpmLoad the client, sample, and man page RPMs
# rpm -U MQSeriesClient-5.3.0-1.i386.rpm
# rpm -U MQSeriesSamples-5.3.0-1.i386.rpm
# rpm -U MQSeriesMan-5.3.0-1.i386.rpmMQ sample programs are installed into /opt/mqm/samp/bin. The C and CPP source for the samples are installed in /opt/mqm/samp.
- The mqm password may have been changed during the install. To reset, run:
# passwd mqm
- Log off as root and log in as user mqm.
- Create a queue manager
crtmqm -q QMNAME- Start the queue manager:
strmqm QMNAME- Create a WebSphere MQ command file, yourfile.mqs, that will create a local queue TESTQ with a max depth of 10 messages; create an alias to TESTQ named TESTQ_ALIAS; create a local queue named TESTQ2 that has the same attributes as TESTQ.
def ql(TESTQ) maxdepth(10) def qalias(TESTQ_ALIAS) targq(TESTQ) def ql(TESTQ2) like(TESTQ)Note that if you create a mixed-case queue name, i.e., TestQ, when executing commands against that queue, place the queue name in single quotes. For example:
def ql('TestQ') maxdepth(10) def qalias('TestQ_Alias') targq('TESTQ') def ql('TestQ2') like('TestQ')- Execute the MQ command file:
$ runmqsc < yourfile.mqs Starting MQSC for queue manager . 1 : def ql(TESTQ) maxdepth(10) AMQ8006: WebSphere MQ queue created. 2 : def qalias(TESTQ_ALIAS) targq(TESTQ) AMQ8006: WebSphere MQ queue created. 3 : def ql(TESTQ2) like(TESTQ) AMQ8006: WebSphere MQ queue created. 3 MQSC commands read. No commands have a syntax error. All valid MQSC commands were processed. $- Start the WebSphere MQ command application runmqsc to process WebSphere MQ commands entered as standard input. Display all of the attributes of TESTQ:
$ runmqsc Starting MQSC for queue manager . dis q(TESTQ) 1 : dis q(TESTQ) AMQ8409: Display Queue details. DESCR(WebSphere MQ Default Local Queue) PROCESS( ) BOQNAME( ) INITQ( ) TRIGDATA( ) CLUSTER( ) CLUSNL( ) QUEUE(TESTQ) CRDATE(2003-04-09) CRTIME(11.57.35) ALTDATE(2003-04-09) ALTTIME(11.57.35) GET(ENABLED) PUT(ENABLED) DEFPRTY(0) DEFPSIST(NO) MAXDEPTH(10) MAXMSGL(4194304) BOTHRESH(0) SHARE DEFSOPT(SHARED) HARDENBO MSGDLVSQ(PRIORITY) RETINTVL(999999999) USAGE(NORMAL) NOTRIGGER TRIGTYPE(FIRST) TRIGDPTH(1) TRIGMPRI(0) QDEPTHHI(80) QDEPTHLO(20) QDPMAXEV(ENABLED) QDPHIEV(DISABLED) QDPLOEV(DISABLED) QSVCINT(999999999) QSVCIEV(NONE) DISTL(NO) DEFTYPE(PREDEFINED) TYPE(QLOCAL) SCOPE(QMGR) DEFBIND(OPEN) IPPROCS(0) OPPROCS(0) CURDEPTH(0)- Display all of the queues in the queue manager:
dis q(*) 2 : dis q(*) AMQ8409: Display Queue details. QUEUE(TESTQ_ALIAS) TYPE(QALIAS) AMQ8409: Display Queue details. QUEUE(TESTQ) TYPE(QLOCAL) AMQ8409: Display Queue details. QUEUE(TESTQ2) TYPE(QLOCAL) AMQ8409: Display Queue details. QUEUE(SYSTEM.ADMIN.CHANNEL.EVENT) TYPE(QLOCAL) AMQ8409: Display Queue details. QUEUE(SYSTEM.ADMIN.COMMAND.QUEUE) TYPE(QLOCAL) AMQ8409: Display Queue details. QUEUE(SYSTEM.ADMIN.PERFM.EVENT) TYPE(QLOCAL) ... AMQ8409: Display Queue details. QUEUE(SYSTEM.DEFAULT.INITIATION.QUEUE) TYPE(QLOCAL) AMQ8409: Display Queue details. QUEUE(SYSTEM.DEFAULT.LOCAL.QUEUE) TYPE(QLOCAL) AMQ8409: Display Queue details. QUEUE(SYSTEM.DEFAULT.MODEL.QUEUE) TYPE(QMODEL) AMQ8409: Display Queue details. QUEUE(SYSTEM.DEFAULT.REMOTE.QUEUE) TYPE(QREMOTE) AMQ8409: Display Queue details. QUEUE(SYSTEM.MQSC.REPLY.QUEUE) TYPE(QMODEL) AMQ8409: Display Queue details. QUEUE(SYSTEM.PENDING.DATA.QUEUE) TYPE(QLOCAL)- Change the queue manager's dead letter queue to SYSTEM.DEAD.LETTER.QUEUE, and then close the command application:
alter qmgr deadq(SYSTEM.DEAD.LETTER.QUEUE) 3 : alter qmgr deadq(SYSTEM.DEAD.LETTER.QUEUE) AMQ8005: WebSphere MQ queue manager changed. end 4 : end- Add the WebSphere MQ sample programs directory to the PATH:
$ PATH=$PATH:/opt/mqm/samp/bin- Using the amqsput sample program, put one or more messages on TESTQ. Press Enter after each message. To terminate, press Ctrl-d to signal end-of-file on the standard input:
$ amqsput TESTQ Sample AMQSPUT0 start target queue is TESTQ Hello TESTQ <-- Press ctrl-d after entering the last message Sample AMQSPUT0 end $
- Using the amqsgbr sample program, browse TESTQ to see the messages on the queue:
$ amqsgbr TESTQ Sample AMQSGBR0 (browse) start Messages for TESTQ 1 <Hello TESTQ> no more messages Sample AMQSGBR0 (browse) end $
- Using the amqsbcg sample program, browse TESTQ to see the messages and their message descriptors on the queue:
$ amqsbcg TESTQ AMQSBCG0 - starts here ********************** MQOPEN - 'TESTQ' MQGET of message number 1 ****Message descriptor**** StrucId : 'MD ' Version : 2 Report : 0 MsgType : 8 Expiry : -1 Feedback : 0 Encoding : 546 CodedCharSetId : 923 Format : 'MQSTR ' Priority : 0 Persistence : 0 MsgId : X'414D5120514D312020202020202020203A40943E01030020' CorrelId : X'000000000000000000000000000000000000000000000000' BackoutCount : 0 ReplyToQ : ' ' ReplyToQMgr : 'QMNAME ' ** Identity Context UserIdentifier : 'mqm ' AccountingToken : X'0335303200000000000000000000000000000000000000000000000000000006' ApplIdentityData : ' ' ** Origin Context PutApplType : '6' PutApplName : 'amqsput ' PutDate : '20030409' PutTime : '16041353' ApplOriginData : ' ' GroupId : X'000000000000000000000000000000000000000000000000' MsgSeqNumber : '1' Offset : '0' MsgFlags : '0' OriginalLength : '-1' **** Message **** length - 8 bytes 00000000: 4865 6C6C 6F20 5131 'Hello TESTQ ' No more messages MQCLOSE- Use the amqsget sample program to clear the messages on TESTQ: The amqsget program will keep listening for new messages on the queue until you use Ctrl-c to terminate it.
$ amqsget TESTQ Sample AMQSGET0 start message <Hello TESTQ> <-- Press ctrl-c to stop listening for messages $You may also use the amqsgbr program to browse the messages on TESTQ to make sure there are none left.
- Using runmqsc, display the attributes of TESTQ to determine how many messages are on the queue (CURDEPTH).
$ runmqsc Starting MQSC for queue manager . dis q(TESTQ) 1 : dis q(TESTQ) AMQ8409: Display Queue details. DESCR(WebSphere MQ Default Local Queue) PROCESS( ) BOQNAME( ) INITQ( ) TRIGDATA( ) CLUSTER( ) CLUSNL( ) QUEUE(TESTQ) CRDATE(2003-04-09) CRTIME(11.57.35) ALTDATE(2003-04-09) ALTTIME(11.57.35) GET(ENABLED) PUT(ENABLED) DEFPRTY(0) DEFPSIST(NO) MAXDEPTH(10) MAXMSGL(4194304) BOTHRESH(0) SHARE DEFSOPT(SHARED) HARDENBO MSGDLVSQ(PRIORITY) RETINTVL(999999999) USAGE(NORMAL) NOTRIGGER TRIGTYPE(FIRST) TRIGDPTH(1) TRIGMPRI(0) QDEPTHHI(80) QDEPTHLO(20) QDPMAXEV(ENABLED) QDPHIEV(DISABLED) QDPLOEV(DISABLED) QSVCINT(999999999) QSVCIEV(NONE) DISTL(NO) DEFTYPE(PREDEFINED) TYPE(QLOCAL) SCOPE(QMGR) DEFBIND(OPEN) IPPROCS(0) OPPROCS(0) CURDEPTH(2)Because we defined TESTQ_ALIAS as an alias for TESTQ, you can see that our display of TESTQ shows that it has two messages.
Type
end
to terminate the session.- Use amqsget to get the messages on TESTQ (or TESTQ_ALIAS).
- Practice disabling the PUT function on TESTQ2:
$ runmqsc Starting MQSC for queue manager . alter ql(TESTQ2) put(disabled) 1 : alter ql(TESTQ2) put(disabled) AMQ8008: WebSphere MQ queue changed.- Attempt to put a message on TESTQ2 to verify that PUT has been disabled:
This fails with an error code, since PUTs have been disabled.$ amqsput TESTQ2 Sample AMQSPUT0 start target queue is TESTQ2 Hello TESTQ2 MQPUT ended with reason code 2051 Sample AMQSPUT0 end $
- Use runmqsc to delete TESTQ2:
$ runmqsc Starting MQSC for queue manager . delete qlocal(TESTQ2) 1 : delete qlocal(TESTQ2) AMQ8007: WebSphere MQ queue deleted.- When you are ready to stop the queue manager, enter the endmqm QMNAME command for normal termination or endmqm -i QMNAME for immediate termination. You can enter the dltmqm QMNAME command to delete the queue manager.
Posted By: Michael Pareene
Last Update: Michael Pareene
Confidential: Acme Corporation.
WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.
IBM is a trademark of the IBM Corporation in the United States, other countries, or both.