IBM mq 常用命令

合集下载

MQ常用命令

MQ常用命令

MQ常用命令以下为MQ常用命令:查看发送通道:display channel(xxx)查看队列管理器: dspmq停止队列管理器:endmqm QMEMBFE删除队列管理器:dltmqm QMEMBFE重置发送通道:reset channel(xxxx)启动通道:start chl(xxxx)查看通道: dis chl(xxx)查看所有通道 dis chl(*) 或 dis chs(*)查看所有监听:dis listener(*) 或 dis lsstatu(listentName)查看本地队列:dis qlocal(xxxxx) 查看其中的CURDEPTH(0),若其>0,则说明本地队列堵塞查看死信队列:dis qlocal(DEADQ)查看本地队列:dis qlocal(*)查看本地队列深度: display ql(xxx) curdepth查看远程队列深度:display qr(xxx) curdepth查看ccsid: display qmgr all显示所有远程队列: display qremote(*)显示所有通道: display channel(*)ping通道:ping CHANNEL(xxxx)清空队列内容:clear Qlocal(Qname)(需运行 runmqsc)删除队列:delete qlocal(Qname)更改监听:alter listener(xxxx) TRPTYPE(TCP) PORT(1417) CONTROL(QMGR)停止监听: end LISTENER(xxxx)查看通道当前序列号: dis chs(xxxx) curseqno查看通道所有状态: dis chs(xxxxx) all。

mq命令

mq命令
TRIGDPTH(1) TRIGMPRI(0)
QDEPTHHI(80) QDEPTHLO(20)
QDPMAXEV(ENABLED) QDPHIEV(DISABLED)
XMITQ(QT_NT)
创建发送方通道,其传输队列为QT_NT,远程主机地址为10.10.10.2,侦听端口为1414
DEFINE CHANNEL(SDR_NT) CHLTYPE(SDR)+
CONNAME(‘10.10.10.2(1414)’) XMITQ(QT_NT) REPLACE
如果队列是默认队列管理器中的队列,可以不带其队列管理器的名字
启动通道
runmqchl –c ChlName –m QmgrName
启动侦听
runmqlsr –t TYPE –p PORT –m QMgrName
停止侦听
endmqlsr -m QmgrName
MQSeries命令
8.退出命令行使用 end 命令。

一.MQ基本操作
MQ中有几个很重要的组件:队列管理器(QueueManager)、队列(Queue)和通道(Channel)。其基本的操作方法如下:
创建队列管理器
crtmqm –q QMgrName
-q是指创建缺省的队列管理器
删除队列管理器
远程队列定义
DEFINE QREMOTE(QRNAME) +
RNAME(AAA) RQMNAME(QMGRNAME) +
XMITQ(QTNAME)
定义模型队列
DEFINE QMODEL(QNAME) DEFTYPE(TEMPDYN)
定义本地传输队列

IBM MQ

IBM MQ

MQ中有几个很重要的组件:队列管理器(QueueManager)、队列(Queue)和通道(Channel)。

其基本的操作方法如下:创建队列管理器crtmqm –q QMgrName-q是指创建缺省的队列管理器删除队列管理器dltmqm QmgrName启动队列管理器strmqm QmgrName如果是启动默认的队列管理器,可以不带其名字停止队列管理器endmqm QmgrName 受控停止endmqm –i QmgrName 立即停止endmqm –p QmgrName 强制停止显示队列管理器dspmq –m QmgrName运行MQSeries命令runmqsc QmgrName如果是默认队列管理器,可以不带其名字往队列中放消息amqsput QName QmgrName如果队列是默认队列管理器中的队列,可以不带其队列管理器的名字从队列中取出消息amqsget QName QmgrName如果队列是默认队列管理器中的队列,可以不带其队列管理器的名字启动通道runmqchl –c ChlName –m QmgrName启动侦听runmqlsr –t TYPE –p PORT –m QMgrName停止侦听endmqlsr -m QmgrNameMQSeries命令定义死信队列DEFINE QLOCAL(QNAME) DEFPSIST(YES) REPLACE设定队列管理器的死信队列ALTER QMGR DEADQ(QNAME)定义本地队列DEFINE QL(QNAME) REPLACE定义别名队列DEFINE QALIAS(QALIASNAME) TARGQ(QNAME)远程队列定义DEFINE QREMOTE(QRNAME) +RNAME(AAA) RQMNAME(QMGRNAME) +XMITQ(QTNAME)定义模型队列DEFINE QMODEL(QNAME) DEFTYPE(TEMPDYN)定义本地传输队列DEFINE QLOCAL(QTNAME) USAGE(XMITQ) DEFPSIST(YES) +INITQ(SYSTEM.CHANNEL.INITQ)+PROCESS(PROCESSNAME) REPLACE创建进程定义DEFINE PROCESS(PRONAME) +DESCR(‘STRING’)+APPLTYPE(WINDOWSNT)+APPLICID(’ runmqchl -c SDR_TEST -m QM_ TEST’)其中APPLTYPE的值可以是:CICS、UNIX、WINDOWS、WINDOWSNT等创建发送方通道DEFINE CHANNEL(SDRNAME) CHLTYPE(SDR)+CONNAME(‘100.100.100.215(1418)’) XMITQ(QTNAME) REPLACE其中CHLTYPE可以是:SDR、SVR、RCVR、RQSTR、CLNTCONN、SVRCONN、CLUSSDR 和CLUSRCVR。

IBM AIX命令手册:IBM MQ管理、安装和卸载说明书

IBM AIX命令手册:IBM MQ管理、安装和卸载说明书

Summary of AIX commands to administrate MQhttps:///support/pages/node/6407842Date last updated: 17-Jun-2021Angel Rivera –*************.comIBM MQ Support+++ Objective +++T o provide the most common AIX commands to administrate, install and uninstall MQ.The organization of the sections is based on what will be the commands to start the installation of MQ from scratch:- ensuring that you have a supported version of AIX: uname, oslevel- create the group “mqm” (mkgroup) and the user “mqm” (mkuser),- unpack the .Z or tar.gz file downloaded from IBM Passport Advantage or IBM Fix Central: gunzip, uncompress, zcat, tar- install/uninstall via installp- querying filesets via lslpp- create (mkusil), list (lsusil), remove (rmusil) a USIL, and- specifying USILs (-R ALL or -R /usr/mqm92) with installp and lslpp++ Update from 17-Jun-2021The AIX command “install -r” that is discussed in this chapter will REJECT all the fix packs installed in the server. If you have only 1 fix pack or if you want to delete at the same time all the fix packs, then the procedure in this chapter is fine.But if you have multiples fix packs and you want to uninstall ONL Y the LATEST one, then you need to use another procedure, which is documented in the article:https:///support/pages/node/6464857Uninstalling only the latest fix pack for MQ in AIX and leaving behind other previous fix packs+++ Related tutorials +++https:///support/pages/node/6405792Customization of an AIX server for using MQ+ Customization of Putty for using Function Key F3 with smitty+ Creating groups and userids+ Downloading, customizing and using the sample scripts+ Customization of bash login for root+ Customization of set-mq-xxx scripts in /usr/local/bin to reflect MQ installations+ Customize the bash login for user "mqm" or the normal user "fulanohttps:///support/pages/node/6407850Installing in AIX - MQ 9.0.0.1 LTS, applying Fix Pack 9.0.0.11, Uninstalling MQChapter 1: How to get the installation imagesChapter 2: Create userid "mqm" and group "mqmChapter 3: Installation of MQ 9.0.0.1 (Installation1 in /usr/mqm)Chapter 4: Setting the environment for MQChapter 5: Creating a test queue manager, quick verification testChapter 6: Installation of the Fix Pack 9.0.0.11Chapter 7: Uninstallation of the Fix Pack 9.0.0.11Chapter 8: Uninstallation of the base 9.0.0.1Chapter 9: Appendices showing full output from installp for the scenarioshttps:///support/pages/node/6415777Upgrading in AIX from MQ 9.0.0.1 to MQ 9.1.0.0 LTSChapter 1: How to get the installation imagesChapter 2: T ake a backup of the queue manager data and recovery logsChapter 3: Uninstalling MQ 9.0Chapter 4: Installing MQ 9.1.0.0 LTSChapter 5: Running setmqenv to use MQ 9.1 commandsChapter 6: Creating a queue manager under 9.1Chapter 7: Upgrading an existing queue manager to MQ 9.1https:///support/pages/node/6415921Installing in AIX - MQ 9.2 LTS to coexist with MQ 9.1 LTS, including applying Fix Packs 9.1.0.7 and 9.2.0.1 Chapter 1: How to get the installation imagesChapter 2: Creating USIL and installing MQ 9.2 side-by-side to MQ 9.1Chapter 3: Need to run setmqenv to use MQ 9.1 or MQ 9.2 commandsChapter 4: Creating a queue manager under MQ 9.2Chapter 5: Migrating an MQ 9.1 queue manager to MQ 9.2Chapter 6: Installing Fix Pack 9.1.0.7 in Installation1 (default location)Chapter 7: Installing Fix Pack 9.2.0.1 in Installation2 (USIL /usr/mqm92)Chapter 8: Uninstallation of MQ 9.2Chapter 9: Deleting the USIL /opt/mqm92https:///support/pages/node/6429607Life cycle for a USIL in AIX for non-default installations of MQ++ Displaying version of operating systemDisplaying the platform and hostname+ROOT+ aglet: /downloads# uname -aAIX aglet 2 7 00F944604C00Displaying the version (high lievel)# oslevel7.2.0.0Displaying the detailed version# oslevel -s7200-05-01-2038+++ Creating group ‘mqm’ and user ‘mqm’The following steps show how to create:- a group “mqm” (gid 202),- a user “mqm” (userid 205),- under /home/mqmLogin as user: rootCreate a group called “mqm” with groupid of 202:mkgroup -'A' id='202' mqmCreate a user also called “mqm” with userid of 205 and who belongs to group “mqm”: mkuser id='205' pgrp='mqm' home='/home/mqm' mqmYou can assign the password:passwd mqmYou can use the command “id” to find out the ids and the group membership:$ id mqmuid=205(mqm) gid=202(mqm) groups=1(staff)+++ How to unpack tar.Z and tar.gz filesWhen you download MQ files from IBM Passport Advantage or IBM Fix Central, there are 2 possible suffixes for the file names:tar.Ztar.gzThe tar options are:-x T o extract members from the archive into the file system.-v T o be verbose about the operation being performed.-f FileArchive T o use the specified file archive as the tar archive.The rest of this section provides more details on how to unpack the files.a) Suffix: tar.ZThe most common ways to unpack this type of files are:a.1) One (1) long compound command (it preserves the file tar.Z)zcat MQ_V9.0_F_AIX_EIMAGE.tar.Z | tar -xvf -The output of zcat is sent to the standard output file (i.e., stdout).This allows the user to decompress the compressed tar file (leaving the compressed file unchanged), and then to expand the tar file to the current directory.The "f -" tar command line option tells the tar command to read its input from the standard input file (i.e., stdin).a.2) T wo (2) simpler commands (the tar.Z is uncompressed, leaving a .tar file) Decompress the file tar.Z by issuing:uncompress MQ_V9.0_F_AIX_EIMAGE.tarThen unpack the file:tar -xvf MQ_V9.0_F_AIX_EIMAGE.tarb) Suffix: tar.gzb.1) One (1) long compound command (it preserves the file tar.gz)gunzip -c IBM_MQ_9.1_AIX.tar.gz | tar -xvf -A common convention is to use the "-c" command line option on the gunzip command so that instead of replacing the tar.gz, the output of the command is sent to the standard output file (i.e., stdout). This allows the user to decompress the compressed tar file (leaving the compressed file unchanged), and expand the tar file to the current directory. The "f -" tar command line option tells the tar command to read its input from the standard input file (i.e., stdin).b.2) T wo (2) simpler commands (the tar.gz is uncompressed, leaving a .tar file) Decompress the file tar.gz by issuing:gunzip IBM_MQ_9.1_AIX.tar.gzThen unpack the file:tar -xvf IBM_MQ_9.1_AIX.tar+++ Creating a USIL to install in a non-default location, such as /usr/mqm92+ Create a dedicated installation directory and designate it as a USILLogin as userid root to create the USIL- Create directory for the USIL.This directory will be designated to be a USIL in a step mentioned later on.# mkdir /usr/mqm92- List the subdirectories that will have the MQ code.Note that /usr/mqm is the default location for Installation1 (in this case,it already has MQ 9.1)# ls -dl /usr/mq*dr-xr-xr-x 20 mqm mqm 4096 Jan 27 07:34 /usr/mqmdrwxr-xr-x 2 root system 256 Jan 27 09:17 /usr/mqm92- So far, we do not have any USI Ls. Let’s verify by issuing the following command:# lsusil(empty)- Make the newly created directory a USIL.Note that the directory will be known as: INSTALL_ROOT_PATH# mkusil -R /usr/mqm92 -c 'MQ 9.2' -Xmkusil: Return Status = SUCCESSWhere:-R /usr/mqm92 => usil location-c comment-X Expands the space needed automatically.- List the USILs and note the new one:# lsusilINSTALL PATH = /usr/mqm92COMMENTS = MQ 9.2- Proceed to use the USIL with installp and lslpp.- If you uninstall MQ from the USIL and if you decide to not use the USIL anymore, then delete it.Please keep in mind that rmusil does not delete the directory structure for the USIL! # rmusil -R /usr/mqm92rmusil: Return Status = SUCCESS- List the USILs (it should show no USILs)# lsusil(empty)- Remove the directory structure that was associated with the USIL:# rm -fr /usr/mqm92+++ Using installp to install and uninstallAfter using “tar -xvf” to unpack the base code to install, you need to go to the newly created directory “MQServer”# cd MQServer++ Install the base code:T o install the base code in the default location /usr/mqm:# installp -acgXYd . all- T o install the base code in a non-default location such as /usr/mqm92# installp -R /usr/mqm92 -acgXYd . allWhere “-R usil” is the path of the User Specified Installation Location (USIL) specified when the product was installed.++ Install the fix pack code on top of an existing installation:T o install the fix pack code in the default location /usr/mqm:# installp -agXYd . all- T o install the fix pack code in a non-default location# installp -R /usr/mqm92 -agXYd . allWhere “-R usil” is the path of the User Specified Installation Location (USIL) specified when the product was installed.++ Reject ALL the Updates (uninstall all the Fix Packs)From the default location:# installp -r "mqm*"From a USIL:# installp -R /usr/mqm92 -r "mqm*"++ Update from 17-Jun-2021The AIX command “install -r” that is discussed in this chapter will REJECT all th e fix packs installed in the server. If you have only 1 fix pack or if you want to delete at the same time all the fix packs, then the procedure in this chapter is fine.But if you have multiples fix packs and you want to uninstall ONL Y the LATEST one, then you need to use another procedure, which is documented in the article:https:///support/pages/node/6464857Uninstalling only the latest fix pack for MQ in AIX and leaving behind other previous fix packs++ Uninstalling the base code:T o uninstall or modify IBM MQ by using installp, enter one of the following commands:- T o uninstall an installation in the default location /usr/mqm:installp -u mqm- T o uninstall an installation in a non-default location:installp -R /usr/mqm92 -u mqmWhere “-R usil” is the path of the User Specified Installation Location (USIL) specified when the product was installed.+++ Using lslpp to list the MQ filesetsa) This is the most comprehensive command to list all the installed MQ filesets ACROSS the different USILs and including the normal location of /usr/mqm.The following shows the output when MQ is not installed at all and there are no USILs. Note that ALL is in UPPERCASE!# lslpp -R ALL -la "mqm.*"+-----------------------------------------------------------------------------+INSTALL ROOT PATH = /+-----------------------------------------------------------------------------+lslpp: 0504-132 Fileset mqm.* not installed.If there are no USILs, then this is the command.In this case, no MQ filesets are installed.# lslpp -la "mqm.*"lslpp: 0504-132 Fileset mqm.* not installed.b) Listing the file sets from the default location /usr/mqm# lslpp -la "mqm*"Fileset Level State Description----------------------------------------------------------------------------Path: /usr/lib/objreposmqm.amqp.rte 9.0.0.1 COMMITTED IBM MQ AMQP Service9.0.0.11 APPLIED IBM MQ AMQP Servicemqm.ams.rte 9.0.0.1 COMMITTED IBM MQ Advanced MessageSecurity9.0.0.11 APPLIED IBM MQ Advanced MessageSecurityc) Listing the file sets for the USIL# lslpp -R /usr/mqm92 -la "mqm*"Fileset Level State Description----------------------------------------------------------------------------Path: /usr/mqm92/usr/lib/objreposmqm.amqp.rte 9.2.0.0 COMMITTED IBM MQ AMQP Servicemqm.ams.rte 9.2.0.0 COMMITTED IBM MQ Advanced - AdvancedMessage Securitymqm.base.runtime 9.2.0.0 COMMITTED IBM MQ Runtime for Client andServerServer+++ References+++ AIX 7.1 documentationhttps:///support/knowledgecenter/en/ssw_aix_71/m_commands/mkusil.htmlAIX 7.1 / Commands / m /mkusil Command.Creates or attaches a new user-specified installation location (USIL) instance.Syntaxmkusil -R RelocatePath -c Comments [-XFa]DescriptionThe mkusil command creates or attaches a new USIL instance.A user-specified installation location (USIL) is a tracked, relocated installation path that is created by the administrator. The location is tracked by the system and can be used as an alternate installation path for packages that use relocation of file sets or software. Multiple instances or versions of the same software package can be installed on a single system by delegating each installation to a separate USIL.An existing USIL instance can be attached or detached from any given system.Each USIL instance maintains its own set of Software Vital Product Data (SWVPD) in three installp parts:InstallRoot/etc/objreposInstallRoot/usr/lib/objreposInstallRoot/usr/share/lib/objrepos++ Information about the flags for the AIX command: installpThe flags for installp mentioned in the online manual for MQ indicate to apply, commit, expand file system, agree with license, using the .toc (table of contents) file and filesets in the current directory:installp -acgXYd . allhttps:///support/knowledgecenter/en/ssw_aix_72/i_commands/installp.htm lAIX 7.2 / Commands / i /installp CommandPurposeInstalls available software products in a compatible installation package.Flags:-R path Indicates a user-specified installation location.-a Applies one or more software products or updates. This is the default action. This flag can be used with the -c flag to apply and commit a software product update when installed.-c Commits all specified updates that are currently applied but not committed. When an update is committed all other software products it is dependent on must also be committed (unless they are already in the committed state). The specified software product is dependent on any software product that is a prerequisite or corequisite of the specified product. If the requisite software products are not in the committed state, the commit fails and error messages are displayed. The -g flag can be used to automatically commit requisite software product updates.-g When used to install or commit, this flag automatically installs or commits, respectively, any software products or updates that are requisites of the specified software product. When used to remove or reject software, this flag automatically removes or rejects dependents of the specified software.-X Attempts to expand any file systems where there is insufficient space to do the installation. This option expands file systems based on current available space and size estimates that are provided by the software product package. Note that it is possible to exhaust available disk space during an installation even if the -X flag is specified, especially if other files are being created or expanded in the same file systems during an installation. Also note that any remote file systems cannot be expanded.-Y Agrees to required software license agreements for software to be installed. This flag is only valid with the -a flag.-d Device Specifies where the installation media can be found.Notice that "d ." means: current directory-r Rejects all specified software updates that are currently applied but not committed. When a software update is rejected any other software product that is dependent on it (that is, those software products that have the specified software product as a requisite) must also be rejected. The -g flag can be used to reject automatically dependent software updates.-u Removes the specified software product and any of its installed updates from the system. The product can be in either the committed or broken state.https:///support/knowledgecenter/ssw_aix_72/l_commands/lslpp.htmlAIX 7.2 /lslpp Command-R { path | ALL } Indicates a user-specified installation location.-a Displays all the information about filesets specified when combined with other flags. This flag shows all updates when combined with the -l flag and all history when combined with the -h flag.-l (lowercase L) Displays the name, most recent level, state, and description of the specified fileset.++ MQ Documentationhttps:///support/knowledgecenter/SSFKSJ_9.2.0/com.ibm.mq.ins.doc/q008600_.htm IBM MQ 9.2.x / Installing and uninstalling IBM MQ / Installing and uninstalling IBM MQ on AIX /Installing IBM MQ server on AIX.You must install the second version of the product in a location that is not the default. To create the non-default installation location you must use the mkusil command, which is available only from the command line..Install the whole product in a non-default location using the -R flag:installp -R USIL_Directory -acgXYd . allhttps:///support/knowledgecenter/SSFKSJ_9.2.0/com.ibm.mq.mig.doc/q008 010_.htmlIBM MQ 9.2.x / IBM MQ / Maintaining and migrating / Applying maintenance to IBM MQ / Applying and removing maintenance on UNIX and Linux /Applying maintenance level updates on AIX (Installation of Fix Packs)*** Note: The components will be either COMMITTED or APPLIED depending on the options chosen when applying the fix pack.https:///support/knowledgecenter/SSFKSJ_9.2.0/com.ibm.mq.mig.doc/q008 020_.htmlIBM MQ 9.2.x / IBM MQ / Maintaining and migrating / Applying maintenance to IBM MQ / Applying and removing maintenance on AIX and Linux /Reverting to the previous maintenance level on AIXT o back out ALL maintenance updates, as the user root, issue the command:installp [ -R usil ] -r "mqm*"https:///support/knowledgecenter/SSFKSJ_9.2.0/com.ibm.mq.ins.doc/q0094 20_.htmlIBM MQ 9.2.x / IBM MQ / Installing and uninstalling / Installing and uninstalling IBM MQ on AIX /Uninstalling or modifying IBM MQ on AIXT o uninstall an installation in the default location /usr/mqm:installp -u mqm+++ end。

MQ通道的维护及常用命令

MQ通道的维护及常用命令

M Q通道的维护及常用命令Company Document number:WTUT-WT88Y-W8BBGB-BWYTT-199986.3.1通道的状态下图显示了所有可能的通道状态层次结构,在 MQ for AIX, iSeries, HP-UX, , Solaris, 和 systems, 和 WebSphere MQ for OS/2 Warp平台,这些状态对连接通道也适用。

?图,通道状态如果通道的状态分为inactive和current两大类;“current”可以是Stopped,Starting,Retrying和Active的情况。

通道Acitve的情况又可分为Initializing,Binding,Requesting,Running,Paused或Stopping的状态。

下图显示通道状态之间的变化关系。

?注意:1. 当通道处于INITIALIZING, BINDING, REQUESTING, RUNNING, PAUSED, or 或STOPPING状态时,这将消耗系统,并且通道的进程或线程正在运行;因为通道是Active状态。

2. 当通道是STOPPED状态时, 会话可能是active,因为下一个状态时未知的。

下面将详细地介绍通道有关的维护命令。

创建通道为创建一个新通道,您需要创建两个通道定义,在通信的双方各定义一个。

这两个通道的名字必须时相同的,而且两端的通道类型必须匹配,例如:发送和接收。

可以使用MQSC命令“DEFINE CHANNEL”来创建通道,在命令中需要指定通道名,通道类型,连接名,通道描述(可选),传输队列名(可选)和传输协议,等还有许多可选的属性可以设置。

注意:建议在WebSphere MQ的网络中所有的通道名唯一,并且通道名中最好包含了源队列器名和目标队列管理器名。

创建通道的例子PE(SDR) +DESCR(’Sender channel to QM2’) +CONNAME(QM2) TRPTYPE(TCP) XMITQ(QM2) CONVERT(YES)I修改通道可以使用 MQSC命令“ALTER CHANNEL”来修改现有通道定义,但是通道名和通道类型不能修改。

MQ常用命令

MQ常用命令

QUEUE(QMB)
TYPE(QLOCAL)
ACCTQ(QMGR)
ALTDATE(2009-02-06)
ALTTIME(11.41.44)
BOQNAME( )
BOTHRESH(0) CLUSTER( )
CLUSNL( ) CLWLPRTY(0)
CLWLRANK(0)
CLWLUSEQ(QMGR)
CRDATE(2008-12-05)
1.查看所有队列管理器 dspmq
查看所有的通道
dis chl(name)/dis chl(*)/dis chl(*) all/dis channel(name)
查看通道状态
dis chs(name)/dis chs(*)/dis chs(*) all
查看队列
display queue(name)
查看队列管理器信息(包括 CCSID 等信息) dis qmgr
种方法。 需要注意的时,当 DEPTH 属性值为0的时候,实际上就形成了同步通信。另外,当采用 Depth 触发时,产生触发消息以后,队列将被修改为非触发方式,如果需要再次触发,需要重新设 置成允许触发。
一般而言,在实际应用中,如果通道设置成触发方式,触发类型往往设置成为 FIRST 和
DEPTH。
6.修改 ccsid
alter qmgr ccsid(“XXX”)
一、MQ 的启动与停止
用 root 用户启/停需要 root 用户包含在 mqm 组中。
1、MQ 的启动 strmqm QMgrName 如果启动默认队列管理器,strmqm 后可以忽略队列管理器名称。 在意外情况停止队列管理器后,启动可能会失败,此时可以检查上次停止后是否有 IPC 资 源未释放,若有请予以删除,删除方法参考下面的“C.清理所有残留在系统内部的信号灯和 共享内存”。

(转)IBMmq基本使用

(转)IBMmq基本使用

(转)IBMmq基本使⽤⼀、下载7.5 Trial版本这是下载⽹址,下载前先必须注册IBM ID,下载完成后⼀路Next即可(注:windows上安装时,会询问是否域环境,初次学习时,为简单起见,建议选择No)安装完成后,MQ的Bin⽬录会⾃动添加到环境变量Path中,以后就可以直接⽤Dos命令⾏窗⼝操作(当然,也可以⽤图形化GUI⽅式通过IBM WebSphere MQ Explorer来管理)注:安装时,强烈建议⽤管理员Administrator⾝份安装,否则安装完成后,有可能license⽆法⽣效、runmqsc命令模式下⽆法正常执⾏命令.⼆、创建队列管理器WIN + R键,输⼊cmd,进⼊命令⾏窗⼝,键⼊:crtmqm QM_TEST创建⼀个队列管理器QM_TEST(你可以改成⾃⼰想要的名字),如果把整个MQ理解成⼀个数据库实例,QM_TEST相当于就是db instance中的schema(或user)命令⾏创建的队列管理器默认是不活动状态的,可以⽤strmqm QM_TEST来启动队列管理器三、创建队列如果说“队列管理器”是db中的schema,那么"队列"就相当于db中的Table了,⽽队列中的每条"消息",就相当于Table中的每条记录,继续在命令⾏窗⼝模式下,输⼊runmqsc QM_TEST将进⼊MQ的交互命令模式,继续输⼊define qlocal(Q1)将创建⼀个本地队列Q1(你可以改成⾃⼰需要的名字),如果此时你打开 "开始菜单->程序->IBM WebSphere MQ->WebSphere MQ Explorer (Installation1)"也能同步在图形界⾯下,看到这个队列最后键⼊end,退出MQ的交互命令模式。

四、发送消息继续在Windows命令模式下,输⼊amqsput Q1 QM_TEST这⾥系统将处于等待⽤户输⼊的状态,随便输⼊⼀些消息,然后连敲⼆次回车,完成消息发送五、接收消息amqsget Q1 QM_TEST把刚才的put换成了get,将从队列管理器QM_TEST的队列Q1中,把消息取出来六、进阶指南熟悉以上命令⾏操作后,还可以⽤图形化的操作⽅式再强化⼀遍(建议还是多⽤命令⾏模式,因为有些操作只能⽤命令⾏完成,⽐如后⾯要提到的修改队列管理器编码)WebSphere MQ Explorer中,从"帮助"菜单⾥调出帮助⽂档,⾥⾯有⼀个不错的教程,强烈推荐新⼿看⼀遍不过,"教程2:将消息发送⾄远程队列"这⾥,帮助⽂档上有⼏个细节没讲透,导致初次⽤命令⾏照着做,可能会不成功,⼏个要点如下:1、通道命名问题发送⽅与接收⽅的通道名称,必须⼀样,这样⼆边才能对应起来2、接收⽅必须要有侦听器,⽽且要处于激活状态3、发送⽅的发送通道中,连接名称格式为:"<接收⽅HostName或IP地址>(接收⽅-队列管理器-侦听器的TCP端⼝) ,不包括"<>“,⽐如⽐如:yangjm(1514)或172.12.134.14(1514)4、发送⽅的发送通道必须处于激活状态,如果通道启动失败,尝试右键->ping/复位,如果还不⾏,检查上述要点1-3是否设置有问题七、远程连接问题图形⽅式添加“远程队列管理器”时,如果远程队列也是7.x或以上版本,当前登录⽤户是管理员时,将提⽰权利不⾜,拒绝连接,原因是7.0以上,MQ提⾼了安全性,会默认拦截管理员,详情可参考IBM上的解释解决⽅式:1. 更换当前⽤户,建⼀个mqm⽤户组(MQ安装后,会默认创建该Windows⽤户组)的⽤户,然后以该⽤户⾝份登录操作2.参考IBM上的解释,如果出于学习⽬的,最简单的做法,就是在runmqsc交互模式下,键⼊ALTER QMGR CHLAUTH(DISABLED) 直接关闭通道认证(⽣产环境不推荐这么做)另外,要想本机上的队列能被远程管理,前提是该队列管理器允许远程管理,操作⽅式:队列管理器上右击->选择"远程管理...",接下来的事情⼤家都知道⼋、字符集编码问题每个队列管理器,都有⼀个CCSID的属性,对应的就是字符集编码,在windows系统中,这个编码应该是1381,如果你是⽤其它OS(⽐如linux)的配置通过脚本导⼊MQ的,可能编码就不是1381了,这会导致在windows上⽆法连接\启动队列管理器,可以通过MQ交互命令⾏修改,runmqsc QM_TEST 进⼊QM_TEST的MQ交互模式DISPLAY QMGR CCSID 查看当前的CCSID属性ALTER QMGR CCSID(1381) 修改字符集编码为1381九、如何从“试⽤版”升级成“正式版”试⽤版默认只能⽤90天,到期后,如果购买了正式版的license,可以通过命令⾏导⼊license,命令如下:setmqprd x:\license\amqpcert.lic注:amqpcert.lic中的P即代表这是Product⽣产版本,setmqprd 后⾯的路径即为license⽂件的所在路径⼗、java连接⽰例代码import com.ibm.mq.MQC;import com.ibm.mq.MQEnvironment;import com.ibm.mq.MQException;import com.ibm.mq.MQGetMessageOptions;import com.ibm.mq.MQMessage;import com.ibm.mq.MQPutMessageOptions;import com.ibm.mq.MQQueue;import com.ibm.mq.MQQueueManager;/** 可以在MQ的资源管理器的某⼀个队列上放⼊测试消息、浏览消息等* 可以放⼊多条消息,按先进先出的⽅式取得*/public class MQTest {private String qManager;// QueueManager名private MQQueueManager qMgr;private MQQueue qQueue;String HOST_NAME;int PORT = 0;String Q_NAME;String CHANNEL;int CCSID;String Msg;public void init() {try {HOST_NAME = "yangjm";//Hostname或IPPORT = 1414;//要有⼀个侦听器,处于活动状态,且监听1414端⼝qManager = "QM_APPLE";Q_NAME = "Q1";//Q1是⼀个本地队列CHANNEL = "DC.SVRCONN";//QM_APPLE上要建⼀个名为DC.SVRCONN的服务器连接通道CCSID = 1381; // 表⽰是简体中⽂,// CCSID的值在AIX上⼀般设为1383,如果要⽀持GBK则设为1386,在WIN上设为1381。

IBMMQ常用命令

IBMMQ常用命令

IBMMQ常用命令IBM MQ是一款广泛应用于企业级应用程序开发和数据传输的消息队列软件。

该软件具有出色的可扩展性和稳定性,可满足不同规模和需求的企业应用场景。

为了更好地管理和操作IBM MQ,下面将介绍IBMMQ常用命令。

1. crtmqm命令crtmqm命令是创建IBM MQ队列管理器的命令。

例如,要创建一个名为QMGR1的队列管理器,我们可以使用以下命令:crtmqm QMGR12. strmqm命令strmqm命令是启动IBM MQ队列管理器的命令。

例如,要启动名为QMGR1的队列管理器,我们可以使用以下命令:strmqm QMGR13. endmqm命令endmqm命令是停止IBM MQ队列管理器的命令。

例如,要停止名为QMGR1的队列管理器,我们可以使用以下命令:endmqm QMGR14. runmqsc命令runmqsc命令是启动IBM MQ命令行管理工具的命令。

我们可以在命令行模式下使用该命令来执行各种MQ管理任务。

例如,要启动runmqsc,我们可以使用以下命令:runmqsc QMGR15. crtmqobj命令crtmqobj命令是创建IBM MQ队列和通道的命令。

例如,要创建一个名为MYQUEUE的本地队列,我们可以使用以下命令:crtmqobj QMGR1 QLOCAL(MYQUEUE)6. dltmqobj命令dltmqobj命令是删除IBM MQ队列和通道的命令。

例如,要删除名为MYQUEUE的本地队列,我们可以使用以下命令:dltmqobj QMGR1 QLOCAL(MYQUEUE)7. display命令display命令是显示IBM MQ队列管理器、队列和其他对象的信息的命令。

例如,要显示名为QMGR1的队列管理器的配置信息,我们可以使用以下命令:display qmgr QMGR18. Inquire命令Inquire命令是查询IBM MQ队列管理器、队列和其他对象的信息的命令。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

IBM MQ常用命令
常用命令
创建队列管理器
crtmqm –q QMgrName
-q是指创建缺省的队列管理器
删除队列管理器
dltmqm QmgrName
启动队列管理器
strmqm QmgrName
如果是启动默认的队列管理器,可以不带其名字
停止队列管理器
endmqm QmgrName 受控停止
endmqm –i QmgrName 立即停止
endmqm –p QmgrName 强制停止
显示队列管理器
dspmq –m QmgrName
运行MQSeries命令
runmqsc QmgrName
如果是默认队列管理器,可以不带其名字
往队列中放消息
amqsput QName QmgrName
如果队列是默认队列管理器中的队列,可以不带其队列管理器的名字从队列中取出消息
amqsget QName QmgrName
如果队列是默认队列管理器中的队列,可以不带其队列管理器的名字启动通道
runmqchl –c ChlName –m QmgrName
启动侦听
runmqlsr –t TYPE –p PORT –m QmgrName
停止侦听
endmqlsr -m QmgrName
MQSeries命令
定义死信队列
DEFINE QLOCAL(QNAME)DEFPSIST(YES)REPLACE
设定队列管理器的死信队列
ALTER QMGR DEADQ(QNAME)
定义本地队列
DEFINE QL(QNAME)REPLACE
定义别名队列
DEFINE QALIAS(QALIASNAME) TARGQ(QNAME)
远程队列定义
DEFINE QREMOTE(QRNAME)+
RNAME(AAA)RQMNAME(QMGRNAME)+
XMITQ(QTNAME)
定义模型队列
DEFINE QMODEL(QNAME)DEFTYPE(TEMPDYN)
定义本地传输队列
DEFINE QLOCAL(QTNAME) USAGE(XMITQ) DEFPSIST(YES) +
INITQ(SYSTEM.CHANNEL.INITQ)+
PROCESS(PROCESSNAME) REPLACE
创建进程定义
DEFINE PROCESS(PRONAME)+
DESCR(‘STRING’)+
APPLTYPE(WINDOWSNT)+
APPLICID(’runmqchl -c SDR_TEST -m QM_ TEST’)
其中APPLTYPE的值可以是:CICS、UNIX、WINDOWS、WINDOWSNT等
创建发送方通道
DEFINE CHANNEL(SDRNAME)CHLTYPE(SDR)+
CONNAME(‘100.100.100.215(1418)’)XMITQ(QTNAME)REPLACE
其中CHLTYPE可以是:SDR、SVR、RCVR、RQSTR、CLNTCONN、SVRCONN、CLUSSDR和CLUSRCVR。

创建接收方通道
DEFINE CHANNEL(SDR_ TEST)CHLTYPE(RCVR)REPLACE
创建服务器连接通道
DEFINE CHANNEL(SVRCONNNAME)CHLTYPE(SVRCONN)REPLACE
显示队列的所有属性
DISPLAY QUEUE(QNAME)[ALL]
显示队列的所选属性
DISPLAY QUEUE(QNAME)DESCR GET PUT
DISPLAY QUEUE(QNAME)MAXDEPTH CURDEPTH
显示队列管理器的所有属性
DISPLAY QMGR [ALL]
显示进程定义
DISPLAY PROCESS(PRONAME)
更改属性
ALTER QMGR DESCR(‘NEW DESCRIPTION’)
ALTER QLOCAL(QNAME)PUT(DISABLED)ALTER QALIAS(QNAME)TARGQ(TARGQNAME)
删除队列
DELETE QLOCAL(QNAME)
DELETE QREMOTE(QRNAME)
清除队列中的所有消息
CLEAR QLOCAL(QNAME)
常用补充命令
显示队列管理器dspmq
显示文件名dspmqfls
启动本地队列管理器strmqm
结束本地队列管理器endmqm
启动通道启动进程runmqchi/runmqchl。

相关文档
最新文档