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