IBM MQ 安装部署
IBM MQ 安装部署
1.安装前准备
IBM MQ 手册:https://www.ibm.com/support/knowledgecenter/zh/SSFKSJ_9.1.0
IBM MQ 试用:https://www.ibm.com/products/mq
IBM MQ 命令:IBM MQ control commands reference
#---安装必要组件---
[root@CentOS ~]# yum -y install bc rpm-build
#---配置内核参数---
[root@CentOS ~]# echo "fs.file-max = 524288" >>/etc/sysctl.conf
[root@CentOS ~]# echo "kernel.threads-max = 32768" >>/etc/sysctl.conf
[root@CentOS ~]# sysctl -p /etc/sysctl.conf
#---更改 limits 值---
[root@CentOS ~]# echo "mqm hard nofile 10240" >>/etc/security/limits.conf
[root@CentOS ~]# echo "mqm soft nofile 10240" >>/etc/security/limits.conf
[root@CentOS ~]# echo "mqm hard nproc 4096" >>/etc/security/limits.conf
[root@CentOS ~]# echo "mqm soft nproc 4096" >>/etc/security/limits.conf
2.IBM MQ 安装
[root@CentOS ~]# tar zxvf IBM_MQ_9.1_LINUX_X86-64_TRIAL.tar.gz
[root@CentOS ~]# cd MQServer && ./mqlicense.sh -accept
#根据需要安装必须要的MQ组件
[root@CentOS MQServer]# rpm --prefix /opt/mqm -ivh MQSeriesRuntime-9.1.0-0.x86_64.rpm \
MQSeriesSamples-9.1.0-0.x86_64.rpm \
MQSeriesJRE-9.1.0-0.x86_64.rpm \
MQSeriesJava-9.1.0-0.x86_64.rpm \
MQSeriesServer-9.1.0-0.x86_64.rpm \
MQSeriesClient-9.1.0-0.x86_64.rpm \
MQSeriesExplorer-9.1.0-0.x86_64.rpm
#---配置环境变量---
[root@CentOS MQServer]# echo "PATH=$PATH:/opt/mqm/bin" >>/etc/profile
3.验证安装
[root@CentOS ~]# id mqm && echo "passw0rd" | passwd --stdin mqm
#注意MQ管理命令必须是属于mqm组的用户才有权限执行,默认创建了mqm用户
[root@CentOS ~]# su - mqm
#检查系统设置是否满足MQ的安装要求
$ /opt/mqm/bin/mqconfig
#设置变量,以便使用各种MQ管理命令
$ ./opt/mqm/bin/setmqenv -s
$ dspmqver
#---安装正式版License---
-bash-4.2$ /opt/mqm/bin/setmqprd ~/licenses/amqpcert.lic
4.队列管理器
创建队列管理器:crtmqm QMA
启动队列管理器:strmqm QMA
运行 MQSC 命令:runmqsc QMA
DEFINE QLOCAL (QUEUE1) 1 : DEFINE QLOCAL (QUEUE1) AMQ8150E: IBM MQ object already exists. end 2 : end One MQSC command read. No commands have a syntax error. One valid MQSC command could not be processed.
显示队列管理器:dspmq
QMNAME(QMA) STATUS(Running).
停止队列管理器:endmqm QMA
删除队列管理器:dltmqm QMA
5.脚本调用 MQSC 命令
export MYTEMPQM=TESTQM export MYPORT=1600 export MQCHLLIB=/var/mqm/qmgrs/$MQTEMPQM/@ipcc crtmqm $MYTEMPQM strmqm $MYTEMPQM runmqlsr -m $MYTEMPQM -t TCP -p $MYPORT & runmqsc $MYTEMPQM << EOF DEFINE CHANNEL(NTLM) CHLTYPE(SVRCONN) TRPTYPE(TCP) DEFINE CHANNEL(NTLM) CHLTYPE(CLNTCONN) QMNAME('$MYTEMPQM') CONNAME('hostname($MYPORT)') ALTER CHANNEL(NTLM) CHLTYPE(CLNTCONN) DEFINE QLOCAL(TESTQ) EOF amqsputc TESTQ $MYTEMPQM << EOF hello world EOF endmqm -i $MYTEMPQM
转自:https://www.desenpast.com/middleware-4481.html