IBM MQ for DB Replication
Installation
MQ 8/9 + RHEL 6/7/8
Installer Files:
- WS_MQ_V8.0_IFR1_LINUX_ON_X86_64_I.tar (主程式)
- 8.0.0-WS-MQ-LinuxX64-FP0011.tar (更新檔)
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
Install the MQ Server
MQ 8
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
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
TIPs:
- 預設 MQ 安裝目錄:/opt/mqm
- 如果安裝時,想變更目錄位置,安裝指令改成
rpm --prefix /opt/customLocation -ivh MQSeriesRuntime-*.rpm MQSeriesServer-*.rpm
- 安裝完成,系統會自動建立帳號 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
# Run MQSC
runmqsc QMA
# Define a local queue called QUEUE1
DEFINE QLOCAL (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
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
runmqsc BQMREP < /tmp/BQMREP.mqsc
Restore Messages
dmpmqmsg -m BQMREP -o BWINQCAP.RESTARTQ -f /tmp/BWINQCAP.RESTARTQ.msg