1、MQ Primer,Author: Esun.YangDate:2010-09-08,Object,Understand what is MQMaster the Basic componentsCan do some of Basic MQ AdministrationCan do some of Simple MQ problem determination,Agenda,MQ Product BriefingMQ Basic ConceptMQ OverviewMQ InstallationMQ Simple AdministrationMQ Simple Trouble shootin
2、g,MQ Product Briefing,在分布式计算环境中,为了集成分布式应用,开发者需要对异构网络环境下的分布式应用提供有效的通信手段。 WebSphere MQ 本质上是一种消息中间件,用于保证异构应用之间的消息传递。应用程序通过MQ接口进行互连通信,可以不必关心网络上的通信细节,从而将更多的注意力集中于应用本身。消息可靠传递事务处理能力安全要求,MQ Basic Concept,消息(Message)在MQ中,我们把应用程序交由MQ传输的数据定义为消息 消息构成:消息描述符(Message descriptor或Message Header),描述消息的特征,如:消息的优先级、生命周
3、期、消息Id等;消息体(Message Body),即用户数据部分。在MQ中,消息分为两种类型,非永久性(non-persistent)消息和永久性(persistent)消息,Message Header,Message Body,Message Properties,More Info about Message descriptor,Detail pls ref http:/ ExpiryPriority Persistence MsgId CorrelId,MQ Basic Concept,队列(Queue)队列是消息的安全存放地,队列存储消息直到它被应用程序处理。可以简单地把队列看成
4、一个容器消息队列以下述方式工作: 程序A形成对消息队列系统的调用,此调用告知消息队列系统,消息准备好了投向程序B; 消息队列系统发送此消息到程序B驻留处的系统,并将它放到程序B的队列中; 适当时间后,程序B从它的队列中读此消息,并处理此信息。,MQ Basic Concept,队列种类:本地队列、远程队列、模板队列、动态队列、别名队列等 本地队列又分为普通本地队列和传输队列 远程队列是目的队列在本地的定义,它类似一个地址指针,指向远程主机上的某个目的队列,它仅仅是个定义,不真正占用磁盘存储空间。,Attributes of objects,Detail Please ref http:/ Cu
5、rrentQDepth DefBind DefPersistence NonPersistentMessageClass,MQ Basic Concept,MQI: MQ API also called as MQIWebSphere MQ Script (MQSC) commandsWebSphere MQ Explorer,MQ Overview (1 of 4),队列管理器 队列管理器是MQ系统中最上层的一个概念,由它为我们提供基于队列的消息服务, 像一数据库实例一样队列 通道 通道是MQ系统中队列管理器之间传递消息的管道,它是建立在物理的网络连接之上的一个逻辑概念。 通道类型:消息通道
6、:消息通道是用于在MQ的服务器和服务器之间传输消息的,需要强调指出的是,该通道是单向的。MQI通道:MQI通道是MQ Client和MQ Server之间通讯和传输消息用的,与消息通道不同,它的传输是双向的 Cluster通道:群集(Cluster)通道是位于同一个MQ 群集内部的队列管理器之间通讯使用的。Listener,MQ Overview (2 of 4),MQCONNMQOPENPUT And GETMQCLOSEMQDISC,Message,Message,App 1,App 2,Queue,MQ Overview (3 of 4),MQ works,MQ Overview (4
7、of 4),MQ的通讯模式点对点通讯 多点广播 发布/订阅(Publish/Subscribe)模式 群集(Cluster),MQ Installation,On WindowsOn UnixCreate mqm group Create mqm user IDCreate file system: /usr/mqm & /var/mqmRun smittyMore information: AHS_MichelinKnowledgeMQ on SVN,MQ Simple Administration,Create a new MQ instance: crtmqm-q default qmg
8、r-lc cycled log-ll liner log-lf log file size(4KB)-ld log pathDelete the existing MQ instance: dltmqmStart a MQ instance: strmqmStop a MQ instance: endmqm受控(或停止) -c 只有在所有应用程序都已断开连接之后,队列管理器才停止。所有连接到该队列的新请求都会失败。这是缺省模式。 立即 -i 队列管理器在完成当前正在处理的所有 MQI 调用后停止。输入此命令后发出的任何 MQI 调用都将失败。任何未完成的工作单元将在队列管理器下一次启动时回滚。
9、 带等待的受控 -w 停止队列管理器的方式与受控选项相同,但是命令提示符要在队列管理器结束之后才返回。 抢先 -p 队列管理器停止而不等待应用程序断开连接或等待 MQI 调用完成。使用此模式可能导致不可预料的结果。,MQ Simple Administration,Display MQ Instance status: dspmqStart MQ Listener: runmqlsr -t TCP -p 1414 -m qmgrname amqsput Put messages on the local queueamqsbcg - Browse the messages of the que
10、ueamqsget - Get the messages from the queue to make the queue emptyrcdmqimg - Recover a queue from where a checkpoint will be done automatically,MQ Simple Administration,MQ Script (MQSC) commands:runmqsc在发送方A: 定义本地传输队列: define qlocal (QMB) usage (xmitq) defpsist(yes)创建远程队列: define qremote (QR.TOB) r
11、name (LQB) rqmname (QMB) xmitq (QMB)定义发送通道: define channel (A.TO.B) chltype (sdr) conname (IP of B) xmitq (QMB) + trptype (tcp)在接收方B:定义本地队列QLB: define qlocal (LQB)创建接收通道: define channel (A.TO.B) chltype (rcvr) trptype (tcp),MQ config files,MQ Configuration FileUnix: /var/mqm/mqs.iniWindows: stores s
12、imilar information in the Windows Registry ( no mqs.ini)Queue Manager Configuration FileUnix: /var/mqm/qmgrs/ qm.iniWindows: stores similar information in the Windows Registry,MQ Process,Check the running MQ processps ef | grep amqps ef | grep mqmMQ base process (on Unix)amqpcsea Command serveramqha
13、smx Logger|amqharmx Log formatter (linear logs only)amqzllp0 Checkpoint processoramqzlaa0 Queue manager agentsamqzfuma OAM processamqzxma0 Processing controlleramqrrmfa Repository process (for clusters)amqzdmaa Deferred message processoramqrmppa Channel receiver,MQ Simple Trouble shooting,Check the
14、MQ objects status.Error logsTwo types Queue Manager Error Logs & System Error LogsFilenamesAMQERR01.LOG, AMQERR02.LOG & AMQERR03.LOGLocation depends on Operating SystemUNIX & LinuxSystem /var/mqm/errorsQM/var/mqm/qmgrs/errors WindowsSystemc:Program FilesIBMWebSphere MQerrorsQM:Program FilesIBMWebSph
15、ere MQqmgrserrors Start MQ trace and recreate the problem.strmqtrc -m -l 2000 -t allendmqtrc -m Other OS & related noteshttp:/ Simple Trouble shooting,FFST (First-failure support technology)provides report of unexpected event has been detected by a QM, which might affect the ability of that QM to pe
16、rform its function.can be read directly by an experienced MQ administrator.created some time previous to external symptoms of a problem being observed can be instrumental in understanding the reason for a problem being experienced.keep any FFST files created by MQ for a reasonable period to provide
17、it to IBM Service representativesFilenames & Locations (Windows, UNIX)AMQnnnnnnnn_mm.FDC (nnnnnnnn process ID, mm sequence number normally 0)UNIX/var/mqm/errorsWindowsc:Program FilesIBMWebSphere MQerrorsOther OS & related noteshttp:/ Simple Trouble shooting,Troubleshooting stepsEnsure that the queue
18、 manager is running.Check the information about the return code from the connection action.For applications connecting as clients, ensure that a listener is running for the QM.Ensure that the transport (usually TCP) and connection name are correct for the QM.If a client channel definition table (CCD
19、T) is being used, ensure that the location specified for this file is correct.For JMS applications, these are specified on the connection factory object in the directory being accessed through JNDI, which must be accessible from the application.For applications connecting as clients, ensure that the
20、 channel name being used matches a server connection channel on the queue manager, or that the channel auto-definition (CHAD) has been enabled on the QM.Channel names are case-sensitive and must match.Ensure that the QM name specified by the application is correct, including the case. For applicatio
21、ns connecting as clients using a CCDT, ensure that the client connection channel object, defined on the QM that created the CCDT, has the correct QM name (QMNAME) attribute.View the WebSphere MQ system error logs.View the queue manager error logs for the queue manager to which the connection is fail
22、ing.Ensure that the user identifier under which the application is connecting has authority to connect to the QM.,MQ Simple Trouble shooting,Messages AMQxxxx xxxx is between 4000 and 9999information displayed to a user administering a MQ infrastructure in response to an action or to signify an event
23、CodesMQCC (completion codes)0 Successful completion (MQCC_OK)1 Warning (partial completion) (MQCC_WARNING) 2 Call failed (MQCC_FAILED) MQRC (reason codes)caused by all actions performed programmatically against MQ and do not completed successfully or only completed partiallyAdditional info on particular message or code can be obtainlocally by running mqrc for particular message/codeon MQ InfoCenter or WebSphere MQ Messages (GC34-6601)For common reason codes:http:/ MQ Messages GC34-6601http:/ Link,MQ information center: http:/ MQ消息通道管理的几点技巧http:/ and A,Thank You,