IBM MQ 安裝部署
安裝前準備
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
IBM MQ 安裝
[root@CentOS ~]# tar zxvf IBM_MQ_9.1_LINUX_X86-64_TRIAL.tar.gz
[root@CentOS ~]# cd MQServer && ./mqlicense.sh -accept
[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
驗證安裝
[root@CentOS ~]# id mqm && echo "passw0rd" | passwd --stdin mqm
[root@CentOS ~]# su - mqm
-bash-4.2$ /opt/mqm/bin/mqconfig
-bash-4.2$ . /opt/mqm/bin/setmqenv -s
-bash-4.2$ dspmqver
#---安裝正式版License---
-bash-4.2$ /opt/mqm/bin/setmqprd ~/licenses/amqpcert.lic
隊列管理器
創建隊列管理器:crtmqm QMA
啓動隊列管理器:strmqm QMA
運行 MQSC 命令:runmqsc QMA
1
2
3
4
5
6
7
8
|
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
1
|
QMNAME
(QMA
)
STATUS
(Running
)
.
|
停止隊列管理器:endmqm QMA
刪除隊列管理器:dltmqm QMA
腳本調用 MQSC 命令
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
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
|