You are on page 1of 7

4/14/2015

developerWorks

CreatingamultiinstancequeuemanagerforWebSphereMQonLinux

Technicaltopics

WebSphere

Technicallibrary

Creatingamultiinstancequeuemanagerfor
WebSphereMQonLinux
ThisarticleshowsyouhowtoimplementthenewWebSphereMQV7multiinstancequeuemanagerfeatureonLinux.
ItprovideshighavailabilitywithoutusinganHACoordinator,byautomaticallyswitchingtoastandbyserveriftheactive
serverfails.Theactiveandstandbyserversaremultipleinstancesofthesamequeuemanagerandsharethesame
messagesanddata,whichresideonnetworkedstorageaccessedviaanetworkfilesystem(NFS)protocol,suchas
NFSV4.

Share:
ChaitraSampigeisaSoftwareTesterworkingontheWebsphereMQTestTeamattheIBMSoftwareLabinBangalore,India.Shehasfour
yearsoftestingexperiencewiththeWebsphereMQTestTeamandalsohandlesWebSphereTxSeriesandWebSphereMQinteroperability
testing.SheisaCertifiedSoftwareTestEngineer(CSTE)andhasaBachelorofEngineeringdegreeinInformationSciencefrom
ViswesvarayaTechnologicalUniversityinIndia.YoucancontactChaitraatcsampige@in.ibm.com.

09June2010

Introduction
IBMWebSphereMQV7canincreasemessagingavailabilityoutofthe
boxwithoutspecializedskillsorhardware.Intheeventofanunplanned
outage,itprovidesautomaticfailoverviamultiinstancequeuemanagers,
andyoucaninitiateplannedoutagessuchastoapplysoftwaremaintenance
viacontrolledswitchovers.

Developanddeployyour
next
appontheIBMBluemix
cloudplatform.

Startyourfreetrial

Messagesanddataformultiinstancequeuemanagersareheldon
networkedstorageaccessedviaamodernnetworkfilesystemprotocol,suchasNetworkFileSystem
(NFS)V4.Youcandefineandstartmultipleinstancesofthequeuemanagerondifferentmachines,with
oneactiveandonestandbyinstance.Theactivequeuemanagerinstanceprocessesmessagesand
acceptsconnectionsfromapplicationsandfromotherqueuemanagers.Itholdsalockonthequeue
managerdatatoensurethatthereisonlyoneactiveinstanceofthequeuemanager.Thestandbyqueue
managerinstanceperiodicallycheckswhethertheactivequeuemanagerinstanceisstillrunning.Ifthe
activequeuemanagerinstancefailsorisnolongerconnected,thestandbyinstanceacquiresthelockon
thequeuemanagerdataassoonasitisreleased,performsqueuemanagerrestartprocessing,and
becomestheactivequeuemanagerinstance.

Prerequisites
SetupWebsphereMQV7accordingtotheguidelinesandinstructionsintheinformationcenter.For
details,seeCreatingamultiinstancequeuemanageronLinux.
UsetwomachinesbothrunningLinuxRHEL5OS.

InstallWebsphereMQV7.0.1.0
1. InstallWebsphereMQV7.0.1.0)onbothmachines.
2. RuntheFileSystemChecktool(amqmfsck)toverifythatthefilesystemiscompliantwithPOSIX
standardsandcapableofsharingqueuemanagerdatatosupportmultiinstancequeuemanagers.
3. BeforerunningtheFileSystemChecktool,createnewdirectoriesonbothmachinesandstarttheNFS
serveronServer1:
1. CreateadirectoryHAunderroot.
2. CreateanotherdirectorymqdataunderHA.
http://www.ibm.com/developerworks/websphere/library/techarticles/1006_sampige/1006_sampige.html

1/7

4/14/2015

CreatingamultiinstancequeuemanagerforWebSphereMQonLinux

3. AddthefollowinguserandgroupownershiptotheHAdirectoryrecursively:chown -R mqm:mqm
/HA .

4. AddthefollowingpermissionstotheHAdirectoryrecursively:chmod -R ug+rwx /HA.

SettingupNFSshare
NFSserver(Server1)
1. UsethefollowingcommandtocheckwhetherNFSison:
chkconfig --list nfs
For example:
[root@lins shared]# chkconfig --list nfs
nfs
0:off
1:off
2:off
3:off
4:off

5:off

6:off

2. IfFields2,3,4,and5areoffintheaboveoutput,thenitmeansthatNFSisturnedoffandyouneedto
turniton:chkconfig nfs on.
3. ToverifywhetherNFSison:
[root@lins shared]# chkconfig --list nfs
nfs
0:off
1:off
2:on
3:on
4:on

5:on

6:off

4. Toexportmountpoint(/HA)toanothernode:
Add /HA *(rw,sync,no_wdelay,fsid=0) to /etc/exports
Start the NFS daemon on Server 1.
/etc/init.d/nfs start
For example:
root@lins shared]# /etc/init.d/nfs start
Starting NFS services:
Starting NFS quotas:
Starting NFS daemon:
Starting NFS mountd:

[
[
[
[

OK
OK
OK
OK

]
]
]
]

5. Toverifythemountpointthatisbeingexportedfromthisservertoanotherserver,usethefollowing
command:
showmount -e
For example: [root@lins shared]# showmount -e
Export list for lins.in.ibm.com: /HA *

NFSclient(Server2)
1. TomounttheexportedfilesystemonServer2,findtheIPaddressofServer1byusingthecommand
ifconfigaonServer1.
2. MountthefilesystemasNFS4fromServer1toServer2:mount -t nfs4 -o hard,intr
9.122.163.105:/ /HA.

3. Runthecommandmount vtocheckwhethertheNFSmountwassuccessful:
For example:
[root@gtstress42 ~]# mount -v
/dev/sdb2 on /testpool type ext3 (rw)
/dev/sda5 on /usr type ext3 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
9.122.163.105:/ on /HA type nfs4 (rw,hard,intr,addr=9.122.163.105)

RunningtheWebSphereMQFileSystemChecktool
1. Changethelogintomqtestonbothmachinestoruntheamqmfscktool:
su - mqtest
export PATH=/opt/mqm/bin:$PATH
amqmfsck /HA/mqdata
For example:
Server 1: [mqst@lins root]$ amqmfsck /HA/mqdata
The tests on the directory completed successfully.
Server 2: [mqst@gtstress42 /]$ amqmfsck /HA/mqdata
The tests on the directory completed successfully.
amqmfsck -c /HA/mqdata
For example:
Server 1: [mqst@lins root]$ amqmfsck -c /HA/mqdata
Start a second copy of this program with the same parameters on another server.
Writing to test file. This will normally complete within about 60 seconds...
The tests on the directory completed successfully.
For example:
Server 2: [mqst@gtstress42 /]$ amqmfsck -c /HA/mqdata
Writing to test file. This will normally complete within about 60 seconds..
The tests on the directly completed successfully
amqmfsck -wv /HA/mqdata (Run this command at the same time on the machines)

http://www.ibm.com/developerworks/websphere/library/techarticles/1006_sampige/1006_sampige.html

2/7

4/14/2015

CreatingamultiinstancequeuemanagerforWebSphereMQonLinux

For example:
Server 1: [mqst@lins root]$ amqmfsck -wv /HA/mqdata
System call: stat("/HA/mqdata",&statbuf)
System call: fd = open("/HA/mqdata/amqmfsck.lkw",O_RDWR,0666)
System call: fchmod(fd,0666)
System call: fstat(fd,&statbuf)
System call: fcntl(fd,F_SETLK,F_WRLCK)
Start a second copy of this program with the same parameters on another server.
File lock acquired.
Press Enter or terminate this process to release the lock.
System call: close(fd)
File lock released.
The tests on the directory completed successfully.
For example:
Server 2 : [mqst@gtstress42 /]$ amqmfsck -wv /HA/mqdata
System call: stat("/HA/mqdata",&statbuf)
System call: fd =open("/HA/mqdata/amqmfsck.lkw",O_RDWR,0666)
System call: fchmod(fd,0666)
System call: fstat(fd,&statbuf)
System call: fcntl(fd,F_SETLK,F_WRLCK)
Waiting for the file lock.
System call: fcntl(fd,F_SETLK,F_WRLCK)
Waiting for the file lock.
System call: fcntl(fd,F_SETLK,F_WRLCK)
Waiting for the file lock.
System call: fcntl(fd,F_SETLK,F_WRLCK)
Waiting for the file lock.
System call: fcntl(fd,F_SETLK,F_WRLCK)
Waiting for the file lock.
System call: fcntl(fd,F_SETLK,F_WRLCK)
Waiting for the file lock.
System call: fcntl(fd,F_SETLK,F_WRLCK)
File lock acquired.
Press Enter or terminate this process to release the lock.
System call: close(fd)
File lock released.
The tests on the directory completed successfully

2. Afterverifyingthefilesystemforfilelocking,youcancreateamultiinstancequeuemanageronthe
selectedmachine:
3. OnServer1:
cd HA
mkdir logs
mkdir qmgrs
chown -R mqm:mqm /HA
chmod -R ug+rwx /HA
crtmqm -ld /HA/logs -md /HA/qmgrs -q QM1

4. CopythequeuemanagerdetailsfromServer1toServer2:
dspmqinf -o command QM1
(Run this command on Server 1)
For example: addmqinf -s QueueManager -v Name=QM1 -v Directory=QM1 -v
Prefix=/var/mqm -v DataPath=/HA/qmgrs/QM1

5. StarttheactiveinstanceofthequeuemanageronServer1.Copytheoutputbelowandruniton
Server2:
strmqm -x QM1
For example:
[mqst@lins HA]$ strmqm -x QM1
WebSphere MQ queue manager 'QM1' starting.
5 log records accessed on queue manager 'QM1' during the log replay phase.
Log replay for queue manager 'QM1' complete.
Transaction manager state recovered for queue manager 'QM1'.
WebSphere MQ queue manager 'QM1' started.
[mqst@lins HA]$ dspmq
QMNAME(QM1)
STATUS(Running)
[mqst@lins HA]$ dspmq -x -o standby
QMNAME(QM1)
STANDBY(Permitted)

http://www.ibm.com/developerworks/websphere/library/techarticles/1006_sampige/1006_sampige.html

3/7

4/14/2015

CreatingamultiinstancequeuemanagerforWebSphereMQonLinux

INSTANCE(lins.in.ibm.com) MODE(Active)
INSTANCE(gtstress42.in.ibm.com) MODE(Standby)
Server 2:
[mqst@gtstress42 /]$ strmqm -x QM1
WebSphere MQ queue manager 'QM1' starting.
A standby instance of queue manager 'QM1' has been started.
The active instance is running elsewhere.
[mqst@gtstress42 /]$ dspmq
QMNAME(QM1)
STATUS(Running as standby)
[mqst@gtstress42 /]$ dspmq -x -o standby
QMNAME(QM1)
STANDBY(Permitted)
INSTANCE(lins.in.ibm.com) MODE(Active)
INSTANCE(gtstress42.in.ibm.com) MODE(Standby)

6. Tocompletelystopamultiinstancequeuemanager,issueanormalendmqmcommandontheactive
instanceonServer1:
endmqm -i QM1
WebSphere MQ queue manager 'QM1' ended.
Both instances end

7. TostopjustthestandbyinstanceonServer2,usethiscommand:
endmqm -x QM1
WebSphere MQ standby queue manager instance 'QM1' ended.

8. Toswitchserversfromactivetostandby,onmachineA,enter:endmqm -is QM1 WebSphere MQ


queue manager 'QM1' ended, permitting switchover to a standby instance. Oncethe

activeinstancehasended,thestandbyinstancewilltrytobecometheactiveinstance:
Server 1:
[mqst@lins HA]$ endmqm -is QM1
WebSphere MQ queue manager 'QM1' ending.
WebSphere MQ queue manager 'QM1' ended, permitting switchover to a standby instance.
[mqst@lins HA]$ dspmq
QMNAME(QM1)
STATUS(Running elsewhere)
Server 2:
[mqst@gtstress42 /]$ dspmq
QMNAME(QM1)
STATUS(Running)

http://www.ibm.com/developerworks/websphere/library/techarticles/1006_sampige/1006_sampige.html

4/7

4/14/2015

CreatingamultiinstancequeuemanagerforWebSphereMQonLinux

Checkingandcreatingusersandgroups
1. TheUIDandGIDofmqmandmqtestmustbethesameonbothmachinesbeforeinstalling
WebSphereMQ.Iftheyaredifferentonthetwonodes,changethemtobethesameandrebootthe
machinetoreflectthechanges.HerearethestepstochangetheUIDandGIDofmqmandmqmtestr:
1. Forexample,ifUIDandGIDofmqmare501onServer1,thenyouneedtosettheUIDandGIDof
mqmonServer2to501:
groupmod -g 501 mqm
usermod -u 501 -g 501 mqm

2. RebootServer2toreflectthechanges.
3. Thesamestepappliestomqtest,andmqtestneedstobeapartofmqmgroup.
4. Tocreatenewmqmandmqtestidsonasystem,usethecommandsbelow:
groupadd -g <GID> mqm
useradd -u <UID> mqm -g mqm
useradd -u <UID> mqtest -g mqm

2. Tocheckthattheidshavebeencreatedcorrectlyonbothmachines,usethecommandsbelow:
id mqm
For example:
Server 1: uid=501(mqm) gid=501(mqm) groups=501(mqm)
Server 2: uid=501(mqm) gid=501(mqm) groups=501(mqm)
id mqtest
For example: Server 1: uid=550(mqtest) gid=501(mqm) groups=501(mqm)
Server 2: uid=550(mqtest) gid=501(mqm) groups=501(mqm)

Acknowledgments
TheauthorwouldliketothankUmmaheshPonnuswamyofIBMSoftwareGroupandSwethaVb
PrabhakarofIBMGlobalBusinessServicesfortheirhelpwiththisarticle.

Resources
RedHatLinux9ReferenceGuide
OnlinedocumentationfromRedHat
WebSphereMQV7informationcenter
AsingleWebportaltoallWebSphereMQV7documentation,with
conceptual,task,andreferenceinformationoninstalling,configuring,and
usingWebSphereMQV7.
WebSphereMQdocumentationlibrary
WebSphereMQproductmanuals.
WebSphereMQdeveloperresourcespage
Technicalresourcestohelpyoudesign,develop,anddeploymessaging
middlewarewithWebSphereMQtointegrateapplications,Webservices,and
transactionsonalmostanyplatform.
WebSphereMQproductpage
Productdescriptions,productnews,traininginformation,supportinformation,
andmore.
IBMRedbook:WebSphereMQV7featuresandenhancements
Describesthefundamentalconceptsandbenefitsofmessagequeuing
technology,describesthenewfeaturesinV7,andprovidesabusiness
scenariothatshowsthosefeaturesinaction.
DownloadafreetrialversionofWebSphereMQV7
A90day,fullfeatured,nochargetrialofWebSphereMQV7
WebSphereMQsupportpage
Asearchabledatabaseofsupportproblemsandtheirsolutions,plus
downloads,fixes,problemtracking,andmore.
http://www.ibm.com/developerworks/websphere/library/techarticles/1006_sampige/1006_sampige.html

DigdeeperintoWebSphereon
developerWorks
Overview
NewtoWebSphere
Technicallibrary(tutorialsandmore)
Forums
Community
Downloads
Products
Events

BluemixDevelopers
Community
Getsamples,articles,product
docs,andcommunityresourcesto
helpbuild,deploy,andmanage
yourcloudapps.

developerWorksWeekly
Newsletter
Keepupwiththebestandlatest
technicalinfotohelpyoutackle
yourdevelopmentchallenges.

DevOpsServices
Softwaredevelopmentinthecloud.
Registertodaytocreateaproject.

IBMevaluationsoftware
EvaluateIBMsoftwareand
solutions,andtransform
challengesintoopportunities.

5/7

4/14/2015

CreatingamultiinstancequeuemanagerforWebSphereMQonLinux

WebSphereMQpublicnewsgroup
AnonIBMforumwhereyoucangetanswerstoyourWebSphereMQ
technicalquestionsandshareyourWebSphereMQknowledgewithother
users.
WebSphereMQSupportPacs
Downloadablecode,documentation,andperformancereportsforthe
WebSphereMQfamilyofproducts.
developerWorksWebSpheredeveloperresources
TechnicalinformationandresourcesfordeveloperswhouseWebSphere
products.developerWorksWebSphereprovidesproductdownloads,howto
information,supportresources,andafreetechnicallibraryofmorethan2000
technicalarticles,tutorials,bestpractices,IBMRedbooks,andonlineproduct
manuals.
developerWorksWebSphereapplicationconnectivitydeveloperresources
Howtoarticles,downloads,tutorials,education,productinfo,andother
resourcestohelpyoubuildWebSphereapplicationconnectivityandbusiness
integrationsolutions.
MostpopularWebSpheretrialdownloads
NochargetrialdownloadsforkeyWebSphereproducts.
WebSphereforums
Productspecificforumswhereyoucangetanswerstoyourtechnical
questionsandshareyourexpertisewithotherWebSphereusers.
WebSphereondemanddemos
Download,watch,andlearnwhatWebSphereproductsandWebSphere
relatedtechnologiescandoforyourcompany.
developerWorksWebSphereweeklynewsletter
ThedeveloperWorksnewslettergivesyouthelatestarticlesandinformation
onlyonthosetopicsthatinterestyou.InadditiontoWebSphere,youcan
selectfromJava,Linux,Opensource,Rational,SOA,Webservices,and
othertopics.Subscribenowanddesignyourcustommailing.
WebSphererelatedbooksfromIBMPress
ConvenientonlineorderingthroughBarnes&Noble.
WebSphererelatedevents
Conferences,tradeshows,Webcasts,andothereventsaroundtheworldof
interesttoWebSpheredevelopers.
developerWorksblogs
JoinaconversationwithdeveloperWorksusersandauthors,andIBMeditors
anddevelopers.
developerWorksWebcasts
FreetechnicalsessionsbyIBMexpertsthatcanaccelerateyourlearning
curveandhelpyousucceedinyourmostdifficultsoftwareprojects.Sessions
rangefromonehourWebcaststohalfdayandfulldaylivesessionsincities
worldwide.
developerWorkspodcasts
Listentointerestingandoffbeatinterviewsanddiscussionswithsoftware
innovators.
developerWorksonTwitter
CheckoutrecentTwittermessagesandURLs.

http://www.ibm.com/developerworks/websphere/library/techarticles/1006_sampige/1006_sampige.html

6/7

4/14/2015

CreatingamultiinstancequeuemanagerforWebSphereMQonLinux

http://www.ibm.com/developerworks/websphere/library/techarticles/1006_sampige/1006_sampige.html

7/7

You might also like