Skip to main content

IBM MQ for DB Replication

Installation

Software Information:

  • MQ8: WS_MQ_V8.0_IFR1_LINUX_ON_X86_64_I.tar (主程式)
  • MQ8: 8.0.0-WS-MQ-LinuxX64-FP0011.tar (更新檔)
  • MQ9: IBM_MQ_9.2.0.5_LINUX_X86-64.tar.gz
  • OS: RHEL 6/7/8

System Configuration: 

Edit /etc/sysctl.d/ibmmq.conf

# for MQ
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.shmmax = 268435456
kernel.sem = 500 256000 250 1024
fs.file-max = 524288
net.ipv4.tcp_keepalive_time = 300
kernel.threads-max = 32768

Apply the changes

sysctl -p /etc/sysctl.d/ibmmq.conf

Edit /etc/security/limits.conf

# for MQ
mqm     hard    nofile  10240
mqm     soft    nofile  10240
MQ 8 Install
tar -xf WS_MQ_V8.0_IFR1_LINUX_ON_X86_64_I.tar
cd server
./mqlicense.sh -text_only
rpm -ivh MQSeriesRuntime-*.rpm MQSeriesServer-*.rpm

Install MQ8-FP0011

mkdir FP0011
tar -xzf 8.0.0-WS-MQ-LinuxX64-FP0011.tar.gz -C FP0011
cd FP0011
rpm -ivh MQSeriesRuntime-*.rpm MQSeriesServer-*.rpm
MQ 9 Install
tar xzf IBM_MQ_9.2.0.5_LINUX_X86-64.tar.gz
cd MQServer
./mqlicense.sh -text_only
rpm -ivh MQSeriesRuntime-*.rpm MQSeriesServer-*.rpm MQSeriesGSKit-*.rpm
IMPORTANT: READ CAREFULLY

Press Enter to continue viewing the license agreement, or
enter "1" to accept the agreement, "2" to decline it, "3"
to print it, "4" to read non-IBM terms, or "99" to go back
to the previous screen.
1    <=== Press 1

Install MQ9-FP0031

mkdir FP0031
tar xzf 9.2.0-IBM-MQ-LinuxX64-FP0031.tar.gz -C FP0031
cd FP0031
rpm -ivh MQSeriesRuntime-*.rpm MQSeriesServer-*.rpm MQSeriesGSKit-*.rpm


Install Notes
  • 預設 MQ 安裝目錄:/opt/mqm
  • 如果安裝時,想變更目錄位置,安裝指令改成 
    rpm --prefix /opt/customLocation -ivh MQSeriesRuntime-*.rpm MQSeriesServer-*.rpm 
  • 安裝完成,系統會自動建立帳號 mqm
  • 帳號 mqm 的 Home: /var/mqm 
Verifying a server installation

RHEL 

su - mqm
vi ~/.bash_profile

.bash_profile:

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

# Set up environment variables for the user mqm
. /opt/mqm/bin/setmqenv -s

Show the MQ version

[mqm@dotnetdev ~]$ dspmqver
Name:        WebSphere MQ
Version:     8.0.0.11
Level:       p800-011-181212.1
BuildType:   IKAP - (Production)
Platform:    WebSphere MQ for Linux (x86-64 platform)
Mode:        64-bit
O/S:         Linux 4.18.0-553.40.1.el8_10.x86_64
InstName:    Installation1
InstDesc:
Primary:     No
InstPath:    /opt/mqm
DataPath:    /var/mqm
MaxCmdLevel: 802
LicenseType: Production

檢視已安裝的 MQ 元件

# List the packages installed
rpm -qa | grep MQ

# Detail Information for the packages installed
rpm -qa | grep MQ | xargs rpm -q --info

Basic Commands

# Create a queue manager called QMA
crtmqm QMA

# Start the queue manager
strmqm QMA

# Enter MQSC console
runmqsc QMA

> DEFINE QLOCAL (QUEUE1)  # Define a local queue called QUEUE1

# Quit MQSC
end

# List all running queue managers
dspmq
dspmq -o installation

# Stop the queue manager QMA
endmqm QMA

# Delete a queue manager QMA
dltmqm QMA

Backup/Restore MQ Configuration

  • Queue Manager: BQMREP

Backup MQ Configuration

su - mqm
dmpmqcfg -m BQMREP -a > /tmp/BQMREP.mqsc

Backup Messages (RestartQ 中會記錄 Capture 啟動時要從哪個 LSN 開始, 因此需移轉至新的 MQ)

dmpmqmsg -m BQMREP -i BWINQCAP.RESTARTQ -f /tmp/BWINQCAP.RESTARTQ.msg

Restore MQ Configuration to new server

crtmqm BQMREP
strmqm BQMREP
runmqsc BQMREP < /tmp/BQMREP.mqsc | tee restore.log

Restore Messages to new server

dmpmqmsg -m BQMREP -o BWINQCAP.RESTARTQ -f /tmp/BWINQCAP.RESTARTQ.msg