MQ

mq
MQ安裝---linux
MQ_V9.0.3_TRIAL_CDR_LNX_ON_X86_64.tar.gz
建立mqm用戶
tar -xf MQ_V9.0.3_TRIAL_CDR_LNX_ON_X86_64.tar.gz
切換至解壓後的目錄:
cd MQServer
受權:
./mqlicense.sh -text_only
再選擇1接受受權。
安裝:
rpm -ivh MQSeriesRuntime-6.0.0-0.i386.rpm
rpm -ivh MQSeriesSDK-6.0.0-0.i386.rpm
rpm -ivh MQSeriesJava-6.0.0-0.i386.rpm
rpm -ivh MQSeriesClient-6.0.0-0.i386.rpm
rpm -ivh MQSeriesSamples-6.0.0-0.i386.rpm
rpm -ivh MQSeriesServer-6.0.0-0.i386.rpm
rpm -ivh MQSeriesMan-7.5.0-2.x86_64.rpm
rpm -ivh MQSeriesMsg_Zh_CN-7.5.0-2.x86_64.rpm
--------------------------------------------------
在服務器和客戶端機器上安裝 Websphere MQ V7.0.1。
這兩臺機器上應有屬於 mqm 組的 mqm 和 mqtest 用戶。
兩臺機器上 mqm 和 mqtest 的用戶 id 和組 id 應該是相同的。
機器 1:
id mqm: uid=301(mqm), gid=301(mqm)
id mqtest: uid=501(mqtest), gid=301(mqm)
機器 2:
id mqm: uid=301(mqm), gid=301(mqm)
id mqtest: uid=501(mqtest), gid=301(mqm)
在 HP-UX 上安裝 NFS
本例中,NFS 服務器爲:hpate1,導出路徑爲:/HA,NFS 客戶端爲:hostile.
HP-UX上的 NFS 服務器配置
1》以 root 身份登陸服務器並進行配置。
2》編輯文件 /etc/rc.config.d/nfsconf,將 NFS_SERVER 和 START_MOUNTD 的值改成 1:
#more /etc/rc.config.d/nfsconf
NFS_SERVER=1
START_MOUNTD=1
3》啓動 nfs.server 腳本:
/sbin/init.d/nfs.server start
4》編輯 /etc/exports 爲每個將要導出的目錄添加一個條目:
# more /etc/exports
/HA
5》強迫 NFS daemon nfsd 重讀 /etc/exports :
#/usr/sbin/exportfs -a
6》使用 showmount -e 驗證 NFS 的安裝:
# showmount -e
export list for hpate1:
HA (everyone)
#
HP-UX 上的 NFS 客戶端設置
1》以 root 身份登陸。
2》檢查 NFS 客戶機上您將要導入的目錄是否爲空或不存在。
3》若是目錄不存在,建立一個目錄:
#mkdir /HA
4》添加一個條目 /etc/fstab 這樣文件系統將會在啓動時自動安裝:
nfs_server:/nfs_server_dir /client_dir nfs defaults 0 0
# more /etc/fstab
hpate1:/ha /ha NFS DEFAULTS 0 0
5》安裝遠程文件系統:
#/usr/sbin/mount -a
6》驗證 NFS 安裝:
# mount -v
hpate1:/HA on /HA type nfs rsize=32768,wsize=32768,NFSv4,dev=4000004
on Tue Aug 3 14:15:18 2010
-----------------------------------
執行 amqmfsck 以驗證文件系統與 POSIX 的標準是否保持一致
本例中: Server1 = stallion.in.ibm.com 和 Server2 = saigon.in.ibm.com。
1》執行不帶任何選項的 amqmfsck 來檢查基本鎖定狀況:
su - mqtest
export PATH=/opt/mqm/bin:$PATH
On Server1:
$ amqmfsck /HA/mqdata
The tests on the directory completed successfully.
On Server2:
$ amqmfsck /HA/mqdata
The tests on the directory completed successfully.
2》執行帶有 -c 選項的 amqmfsck 來測試寫入目錄:
On Server1:
$ amqmfsck -c /HA/mqdata
Start a second copy of this program with the same parameters on another server.
Writing to test file.
This will normally complete within about 60 seconds.
.................
The tests on the directory completed successfully.
On Server2:
$ amqmfsck -c /HA/mqdata
Start a second copy of this program with the same parameters on another server.
Writing to test file.
This will normally complete within about 60 seconds.
.................
The tests on the directory completed successfully.
3》在兩臺機器上同步執行帶有 -w 選項的 amqmfschk,檢測等待同時釋放對目錄的鎖定:
On Server1:
$ $ amqmfsck -wv /HA/mqdata
System call: stat("/HA/mqdata",&statbuf)
System call: statvfs("/HA/mqdata")
System call: fd = open("/HA/mqdata/amqmfsck.lkw",O_CREAT|O_RDWR,0666)
System call: fchmod(fd,0666)
System call: fstat(fd,&statbuf)
System call: fcntl(fd,F_SETLK,F_WRLCK)
Start a second copy of this program with the same parameters on another server.
File lock acquired.
Press Enter or terminate this process to release the lock.
On Server2:
$ amqmfsck -wv /HA/mqdata
System call: stat("/HA/mqdata",&statbuf)
System call: statvfs("/HA/mqdata")
System call: fd = open("/HA/mqdata/amqmfsck.lkw",O_CREAT|O_RDWR,0666)
System call: fchmod(fd,0666)
System call: fstat(fd,&statbuf)
System call: fcntl(fd,F_SETLK,F_WRLCK)
Waiting for the file lock.
System call: fcntl(fd,F_SETLK,F_WRLCK)
Waiting for the file lock.
System call: fcntl(fd,F_SETLK,F_WRLCK)
Waiting for the file lock.
System call: fcntl(fd,F_SETLK,F_WRLCK)
Waiting for the file lock.
System call: fcntl(fd,F_SETLK,F_WRLCK)
Waiting for the file lock.
System call: fcntl(fd,F_SETLK,F_WRLCK)
Waiting for the file lock.
System call: fcntl(fd,F_SETLK,F_WRLCK)
Waiting for the file lock.
System call: fcntl(fd,F_SETLK,F_WRLCK)
Waiting for the file lock.
System call: fcntl(fd,F_SETLK,F_WRLCK)
File lock acquired.
Press Enter or terminate this process to release the lock.
System call: close(fd)
File lock released.
The tests on the directory completed successfully.
-------------------------------
安裝一個多實例隊列管理器
本例中,Server1 = stallion.in.ibm.com 和 Server2 = saigon.in.ibm.com.
Server 1
1》在共享文件系統中建立日誌和 qmgrs 目錄:
# mkdir logs
# mkdir qmgrs
# chown -R mqm:mqm /HA
# chmod -R ug+rwx /HA
2》建立隊列管理器:
# crtmqm -ld /HA/logs -md /HA/qmgrs -q QM1
WebSphere MQ queue manager created.
Directory '/HA/qmgrs/QM1' created.
Creating or replacing default objects for QM1.
Default objects statistics : 65 created. 0 replaced. 0 failed.
Completing setup.
Setup completed.
#
3》從 Server1 中複製隊列管理器配置細節:
# dspmqinf -o command QM1
4》將上述命令複製到 Notepad。輸出格式以下:
addmqinf -s QueueManager -v Name=QM1 -v Directory=QM1 -v Prefix=/var/mqm -v
DataPath=/HA/qmgrs/QM1
Server 2
1》粘帖步驟 4 保存在 Notepad 中的輸出命令:
# addmqinf -s QueueManager -v Name=QM1 -v Directory=QM1 -v Prefix=/var
/mqm -v DataPath=/HA/qmgrs/QM1
WebSphere MQ configuration information added.
#
2》啓動 Server 1 中隊列管理器的活動實例:
# strmqm -x QM1
WebSphere MQ queue manager 'QM1' starting.
5 log records accessed on queue manager 'QM1' during the log replay phase.
Log replay for queue manager 'QM1' complete.
Transaction manager state recovered for queue manager 'QM1'.
WebSphere MQ queue manager 'QM1' started.
#
3》啓動 Server 2 中隊列管理器的備用實例:
# strmqm -x QM1
WebSphere MQ queue manager QM1 starting.
A standby instance of queue manager QM1 has been started.
The active instance is running elsewhere.
#
4》使用 dspmq -x 驗證安裝:
On Server1 (stallion)
# dspmq -x
QMNAME(QM1) STATUS(Running)
INSTANCE(stallion) MODE(Active)
INSTANCE(saigon) MODE(Standby)
#
On Server2 (saigon)
# dspmq -x
QMNAME(QM1) STATUS(Running as standby)
INSTANCE(stallion) MODE(Active)
INSTANCE(saigon) MODE(Standby)
------------------------------------
建立一個客戶端自動重鏈接安裝
本例中,Server1 = lins.in.ibm.com 和 Server2 = gtstress42.in.ibm.com。在 Server 1:
1》使用 defpsist(yes) 建立一個名爲 Q 的本地隊列。
2》建立一個名爲 CHL 的 svrconn 通道。
3》啓動一個運行在 9898 端口的監聽器:
# runmqsc QM1
5724-H72
(C) Copyright IBM Corp. 1994, 2009. ALL RIGHTS RESERVED.
Starting MQSC for queue manager QM1.
def ql(Q) defpsist(yes)
1 : def ql(Q) defpsist(yes)
AMQ8006: WebSphere MQ queue created.
define channel(CHL) chltype(SVRCONN) trptype(tcp) MCAUSER('mqm') replace
2 : define channel(CHL) chltype(SVRCONN) trptype(tcp) MCAUSER('mqm') replace
AMQ8014: WebSphere MQ channel created.
end
# runmqlsr -m SAMP -t tcp -p 9898 &
[1] 26866
]# 5724-H72
(C) Copyright IBM Corp. 1994, 2009. ALL RIGHTS RESERVED.
4》在 Server 1 上把 MQSERVER 設置爲變量:
Export MQSERVER=<channelname>/tcp/<server1(port), server2(port)>
For example: export MQSERVER=CHL/TCP/'9.122.163.105(9898),9.122.163.77(9898)'
5》在 Server 2 上,啓動端口 9898上的一個監聽器:
# runmqlsr -m QM1 -t tcp -p 9898 &
[1] 24467
[root@gtstress42 ~]# 5724-H72
(C) Copyright IBM Corp. 1994, 2009. ALL RIGHTS RESERVED.
-------------------------------------------
執行客戶端自動重鏈接樣例
Server 1
1》調用 amqsphac 樣例程序:
# amqsphac Q QM1
Sample AMQSPHAC start
target queue is Q
message < Message 1 >
message < Message 2 >
message < Message 3 >
message < Message 4 >
message < Message 5 >
message < Message 6 >
message < Message 7 >
message < Message 8 >
message < Message 9 >
message < Message 10 >
2》在 Server 1 的另外一個窗口中,使用 -is 選項結束隊列管理器,這樣它將切換到備用隊列管理器:
Server 1(new session):
# endmqm -is QM1
WebSphere MQ queue manager 'QM1' ending.
WebSphere MQ queue manager 'QM1' ended, permitting switchover to a standby
3》驗證一個切換是否已發生:
On Server2:
# dspmq -x -o standby
QMNAME(QM1) STANDBY(Permitted)
INSTANCE(gtstress42.in.ibm.com) MODE(Active) instance.
4》該鏈接將斷開,且備用隊列管理器中出現重鏈接:
On Server 1
16:12:28 : EVENT : Connection Reconnecting (Delay: 57ms)
10/06/2010 04:12:35 PM AMQ9508: Program cannot connect to the queue manager.
10/06/2010 04:12:35 PM AMQ9999: Channel program ended abnormally.
16:12:37 : EVENT : Connection Reconnecting (Delay: 0ms)
10/06/2010 04:12:37 PM AMQ9508: Program cannot connect to the queue manager.
10/06/2010 04:12:37 PM AMQ9999: Channel program ended abnormally.
16:12:37 : EVENT : Connection Reconnected
16:12:38 : EVENT : Connection Broken
message < Message 11 >
message < Message 12 >
message < Message 13 >
message < Message 14 >
message < Message 15 >
message < Message 16 >
message < Message 17 >
message < Message 18 >
message < Message 19 >
message < Message 20 >
message < Message 21 >
message < Message 22 >
5》在 Server 1 上運行樣例程序 amsghac,獲得如下信息:
# amqsghac Q SAMP
Sample AMQSGHAC start
10/06/2010 04:14:33 PM AMQ9508: Program cannot connect to the queue manager.
10/06/2010 04:14:33 PM AMQ9999: Channel program ended abnormally.
message < Message 1 >
message < Message 2 >
message < Message 3 >
message < Message 4 >
message < Message 5 >
message < Message 6 >
message < Message 7 >
message < Message 8 >
message < Message 9 >
message < Message 10 >
message < Message 11 >
message < Message 12 >
message < Message 13 >
message < Message 14 >
message < Message 15 >
message < Message 16 >
message < Message 17 >
message < Message 18 >
message < Message 19 >
message < Message 20 >
message < Message 21 >
message < Messagee 22 >
相關文章
相關標籤/搜索