项目中可能会用到MQ,今天做了一番研究。



首先来看安装

1.下载 WebSphere MQ 7.0.  试用版可以使用90天。

http://www.ibm.com/developerworks/downloads/ws/wmq/.

注意下载合适的版本,我的环境是RHEL5 32 位

2.然后把下载的压缩包FTP到Linux服务器上,可以用WSCP等工具。

3.解压

gunzip ./WMQv700Trial-x86_linux.tar.gz
tar -xvf ./ WMQv700Trial-x86_linux.tar
 
4.接受条件(没得选择)
./mqlicense.sh ––accept
 
5.开始安装
rpm -ivh MQSeriesRuntime-7.0.0-0.i386.rpm
rpm -ivh MQSeriesServer-7.0.0-0.i386.rpm
rpm -ivh MQSeriesSamples-7.0.0-0.i386.rpm
 
6.检查安装
安装程序会自动创建一个mqm 用户。
切换到 mqm , su mqm
然后运行  /opt/mqm/bin/dspmqver
 
 
 
MQ基础
 
1.WebSphere MQ中的所有对象都区分大小写。
2.不能从一个远程队列读取消息(只能从本地队列)。
3.只能把
消息 放到本地队列(不能放到远程队列)。
  
 
MQ queues 传输示意图


 

WebSphere MQ 之初体验_第1张图片

 
MQ commands
 
amqccert - Check certifi cate chains
amqmdain - WebSphere MQ services control
amqtcert - Transfer certifi cates
crtmqm - Create Queue Manager
dltmqm - Delete queue manager
dmpmqaut - Dump authority
dmpmqlog - Dump log
dspmq - Display Queue Managers
dspmqaut - Display authority
dspmqcsv - Display command server
dspmqfls - Display fi les
dspmqrte - WebSphere MQ display route application
dspmqtrc - Display formatted trace output
dspmqtrn - Display transactions
dspmqver - Display version information
endmqcsv - End command server
endmqlsr - End listener
endmqdnm - Stop .NET monitor
endmqm - End Queue Manager
endmqtrc - End trace
mqftapp - Run File Transfer Application GUI
mqftrcv - Receive fi le on server
mqftrcvc - Receive fi le on client
mqftsnd - Send fi le from server
mqftsndc - Send fi le from client
rcdmqimg - Record media p_w_picpath
rcrmqobj - Recreate object
rsvmqtrn - Resolve transactions
runmqchi - Run channel initiator
runmqchl - Run channel
runmqdlq - Run dead-letter queue handler
runmqdnm - Run .NET monitor
runmqlsr - Run listener
runmqsc - Run MQSC commands
runmqtmc - Start client trigger monitor
runmqtrm - Start trigger monitor
setmqaut - Set or reset authority
setmqcrl - Set certifi cate revocation
setmqscp - Set service connection points
strmqcfg - Start WebSphere MQ Explorer
strmqcsv - Start command server
strmqm - Start Queue Manager
strmqtrc - Start trace
 
 
创建/启动/停止/删除 队列管理器

创建
crtmqm LPTST

启动
strmqm  LPTST
 
查看
dspmq
 
停止
endmqm -i  LPTST
 
删除 
删除之前注意把所有侦听停掉,然后再停止队列管理器,最后再删除
 
endmqlsr -w -m  LPTST
endmqm -i LPTST
dltmqm  LPTST