MQ on AKS
Merative Social Program Management (SPM) supports only IBM MQ LTS on a VM , when running on AKS. The following steps outline how to do this. In this runbook we will outline the steps to create:
For the runbook, two standalone VMs were used as MQ nodes.
Queue manager names
For runbook configuration, the following naming conversion was used throughout the MQ setup: NamingConvention_AppName
. This must be unique, but ensure you change the commands used on this page accordingly.
Queue Name:
- minikube_curam
Channel Name: This value should be all capitals
CHL_NamingConvention_AppName
- CHL_MINIKUBE_CURAM
Listeners Name: This value should be all capitals
LS_NamingConvention_AppName
- LS_MINIKUBE_CURAM
MQ stages
On both MQ nodes run the following command as root:
su - mqm # Changing user into mqmexport PATH=/opt/mqm/inst1/bin:$PATH
Shared storage
Create the shared storage for our nodes.
On the shared node run the following commands:
mkdir -p /MQHA/logsmkdir -p /MQHA/qmgrsmkdir -p /MQHA/scratchuseradd mqha -s /sbin/nologinchown -R mqha:mqha /MQHA/*
Verify that the UID and GUID match the owner ID by running the following command:
echo "/MQHA MQ.FQDN(rw,sync,no_wdelay,fsid=0,anonuid=1001,anongid=1001)" >> /etc/exports
Start and enable both the nfs service and rpcbind service by running the following commands:
systemctl start nfs-server.servicesystemctl enable nfs-server.servicesystemctl start rpcbindsystemctl enable rpcbind
On MQ nodes run the following commands:
echo "SHAREDNODEADDRESS:/MQHA /MQHA nfs defaults 0 0" >> /etc/fstabsystemctl start rpcbindsystemctl enable rpcbindmkdir -p /MQHAchmod 1777 /MQHA #Check permissionsmount /MQHA
Create QMs
When creating the queue, start on the secondary node first then move to the primary node.
On the secondary MQ node, run the following commands:
crtmqm -ld /MQHA/logs -md /MQHA/qmgrs minikube_curamdspmqinf -o command minikube_curam
Save the output of the dspmqinf -o command minikube_curam
command, it should look like the following:
addmqinf -s QueueManager -v Name=minikube_curam -v Directory=minikube_curam -v Prefix=/var/mqm -v DataPath=/MQHA/qmgrs/minikube_curam
Wait for /MQHA/qmgrs/minikube_curam/qm.ini to appear on other node
On the primary MQ node run the following commands:
addmqinf -s QueueManager -v Name=minikube_curam -v Directory=minikube_curam -v Prefix=/var/mqm -v DataPath=/MQHA/qmgrs/minikube_curamstrmqm -x minikube_curam
On the secondary MQ node run the following command:
strmqm -x minikube_curam
Create queues
On the primary MQ node run the following commands:
runmqsc minikube_curam <<-EOSDEFINE QLOCAL(QN.CURAMDEADMESSAGEQUEUE) CLWLUSEQ (ANY) DEFBIND (NOTFIXED)DEFINE QLOCAL(QN.WORKFLOWERROR) BOTHRESH(5) BOQNAME(QN.CURAMDEADMESSAGEQUEUE) CLWLUSEQ (ANY) DEFBIND (NOTFIXED)DEFINE QLOCAL(QN.WORKFLOWENACTMENT) BOTHRESH(5) BOQNAME(QN.WORKFLOWERROR) CLWLUSEQ (ANY) DEFBIND (NOTFIXED)DEFINE QLOCAL(QN.WORKFLOWACTIVITY) BOTHRESH(5) BOQNAME(QN.WORKFLOWERROR) CLWLUSEQ (ANY) DEFBIND (NOTFIXED)DEFINE QLOCAL(QN.DPERROR) BOTHRESH(5) BOQNAME(QN.CURAMDEADMESSAGEQUEUE) CLWLUSEQ (ANY) DEFBIND (NOTFIXED)DEFINE QLOCAL(QN.DPENACTMENT) BOTHRESH(5) BOQNAME(QN.DPERROR) CLWLUSEQ (ANY) DEFBIND (NOTFIXED)ALTER QMGR CHLAUTH(DISABLED)ALTER QMGR DEADQ(QN.CURAMDEADMESSAGEQUEUE)
Create listeners
On the primary MQ node run the following commands:
runmqsc minikube_curam <<-EOSDEFINE LISTENER (LS_MINIKUBE_CURAM) TRPTYPE (TCP) CONTROL (QMGR) PORT (1414)START LISTENER (LS_MINIKUBE_CURAM)EOS
Create channels
On the primary MQ node run the following command:
- Enter your MQ node names into the following commands:
runmqsc minikube_curam <<-EOSDEFINE CHANNEL(CHL_MINIKUBE_CURAM) CHLTYPE(SVRCONN) TRPTYPE(TCP) MCAUSER('mqm') SSLCIPH (TLS_RSA_WITH_AES_128_CBC_SHA256) CERTLABL ('ibmwebspheremqminikube_curam') SSLCAUTH (OPTIONAL) REPLACEDEFINE CHANNEL(CHL_MINIKUBE_CURAM) CHLTYPE(CLNTCONN) TRPTYPE(TCP) CONNAME('Node1(1414),Node2(1414)') QMNAME(minikube_curam) SSLCIPH (TLS_RSA_WITH_AES_128_CBC_SHA256) CERTLABL ('ibmwebspheremqminikube_curam') REPLACEEOS
Create topics
On the primary MQ node run the following command:
runmqsc minikube_curam <<-EOSDEFINE TOPIC (CURAMCACHEINVALIDATIONTOPIC) TOPICSTR (CURAMCACHEINVALIDATIONTOPIC)ALTER QMGR CONNAUTH('CHECK.PWD')DEFINE AUTHINFO('CHECK.PWD') AUTHTYPE(IDPWOS) CHCKLOCL(OPTIONAL) CHCKCLNT(OPTIONAL)EOS
Configure security
The configuration of security is in four parts
- Setting the object type.
- Creating the keystore and certs.
- Updating the certs on both nodes.
- Refreshing security settings.
On the secondary MQ node run the following command:
useradd -g 0 -M mqclient && usermod -L mqclient
On the primary MQ node run the following commands:
useradd -g 0 -M mqclient && usermod -L mqclientrunmqsc minikube_curam <<-EOSSET AUTHREC OBJTYPE(QMGR) PRINCIPAL('mqclient') AUTHADD(ALL)SET AUTHREC OBJTYPE(QUEUE) PROFILE('QN.DPENACTMENT') PRINCIPAL('mqclient') AUTHADD(ALL)SET AUTHREC OBJTYPE(QUEUE) PROFILE('QN.DPERROR') PRINCIPAL('mqclient') AUTHADD(ALL)SET AUTHREC OBJTYPE(QUEUE) PROFILE('QN.WORKFLOWACTIVITY') PRINCIPAL('mqclient') AUTHADD(ALL)SET AUTHREC OBJTYPE(QUEUE) PROFILE('QN.WORKFLOWENACTMENT') PRINCIPAL('mqclient') AUTHADD(ALL)SET AUTHREC OBJTYPE(QUEUE) PROFILE('QN.WORKFLOWERROR') PRINCIPAL('mqclient') AUTHADD(ALL)SET AUTHREC OBJTYPE(QUEUE) PROFILE('QN.CURAMDEADMESSAGEQUEUE') PRINCIPAL('mqclient') AUTHADD(ALL)
runmqckm -keydb -create -db /MQHA/qmgrs/minikube_curam/ssl/key.kdb -type cms -pw Passw0rd -stashrunmqakm -cert -create -db /MQHA/qmgrs/minikube_curam/ssl/key.kdb -stashed -label ibmwebspheremqminikube_curam -size 2048 -dn "CN=minikube_curam,O=IBM,C=US" -x509version 3 -expire 365 -sig_alg SHA256WithRSArunmqakm -cert -extract -db /MQHA/qmgrs/minikube_curam/ssl/key.kdb -stashed -label ibmwebspheremqminikube_curam -target /MQHA/qmgrs/minikube_curam/ssl/key_minikube_curam.armrunmqakm -cert -export -db /MQHA/qmgrs/minikube_curam/ssl/key.kdb -stashed -label ibmwebspheremqminikube_curam -target /MQHA/qmgrs/minikube_curam/ssl/key_minikube_curam.p12 -target_type pkcs12 -target_pw Passw0rd
openssl pkcs12 -in /MQHA/qmgrs/minikube_curam/ssl/key_minikube_curam.p12 -passin pass:Passw0rd -nocerts -nodes | sed -ne '/-BEGIN PRIVATE KEY-/,/-END PRIVATE KEY-/p' > /MQHA/qmgrs/minikube_curam/ssl/tls.keyopenssl pkcs12 -in /MQHA/qmgrs/minikube_curam/ssl/key_minikube_curam.p12 -passin pass:Passw0rd -clcerts -nokeys | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /MQHA/qmgrs/minikube_curam/ssl/tls.crt
runmqsc minikube_curam <<-EOSALTER QMGR CONNAUTH('CHECK.PWD')DEFINE AUTHINFO('CHECK.PWD') AUTHTYPE(IDPWOS) CHCKLOCL(OPTIONAL) CHCKCLNT(OPTIONAL)REFRESH SECURITY TYPE(SSL)REFRESH SECURITY TYPE(AUTHSERV)REFRESH SECURITY TYPE(CONNAUTH)EOS
After these stages have been run MQ should be configured.
Clean up QMs/channels/listeners
Used these steps if you are reconfiguring MQ or cleaning up MQ.
On both MQ nodes run the following commands:
endmqm -w minikube_curamdltmqm minikube_curamrmvmqinf minikube_curam
On either MQ node run the following commands:
rm -rf /MQHA/qmgrs/**rm -rf /MQHA/logs/**rm -rf /MQHA/scratchendmqm -w minikube_curamdltmqm minikube_curamrmvmqinf minikube_curam