close
2007年12月9日 星期日

.
. IBM WebSphere MQ v6.0
. Ex 3 - IBM WebSphere MQ Recovery
. 讓我們來練習一下 MQ 的 Recovery
.

=== Exercise 3 : Recovery ===
What we will do :
A. Create a Queue Manager with LINEAR logging.
B. Put persistent and non-persistent messages on Local Queues.
C. Stop and restart a Queue Manager.
D. Recover a danaged Local Queue from its media image.
E. Record manually media images to optimize media recovery.


======================================================
[A. Create a Queue Manager with LINEAR logging.]
1. Create a new Queue Manager named QML00A with LINEAR logging :
 # crtmqm -ll QML00A   (QML00A is your Queue Manager)

※ Default is CIRCULAR, so must add -ll
 - 由 /var/mqm/mqs.ini 定義 LogType=CIRCULAR
 - Windows 下
  HKEY_LOCAL_MACHINE\SOFTWARE\IBM\MQSeries\CurrentVersion\Configuration\LogDefaults
 - LogType=CIRCULAR 可改成 LogType=LINEAR

※ 檢查方式為 /var/mqm/qmgrs/QML00A/qm.ini, LogType=LINEAR

2. Start the Queue Manager :
 # strmqm QML00A

[B. Put persistent and non-persistent messages on Local Queues.]
3. Prepare two Local Queues, the default persistence of each Queue should be set YES.
 # runmqsc QML00A
 DEF QL(QL.A) DEFPSIST(YES) REPLACE
 DEF QL(QL.B) DEFPSIST(YES) REPLACE


 Prepare two Alias Queues, the default persistence of each Alias Queue should be set NO.
 DEF QA(QA.A) TARGQ(QL.A) DEFPSIST(NO) REPLACE
 DEF QA(QA.B) TARGQ(QL.B) DEFPSIST(NO) REPLACE

 Clear the Local Queues :
 CLEAR QL(QL.A)
 CLEAR QL(QL.B)


4. Using amqsput to PUT a mixture of persistent and nonpersistent messages.
 - Persistent messages naming the Local Queue.
 - Non-Persistent messages aming the Alias Queue.
 # amqsput QL.A QML00A (放入 Persistent messages)
 # amqsput QA.A QML00A (放入 Non-Persistent messages)
 # amqsput QL.B QML00A
 # amqsput QA.B QML00A

5. Using amqsbcg to browse the messages on the Local Queue QL.A
 # amqsbcg QL.A QML00A

[C. Stop and restart a Queue Manager.]
6. Stop the Queue Manager and then start it again.
 # emdmqm [-i] QML00A
 # startmqm QML00A

7. Browse the messages on Queue QL.A by using the amqsbcg application. Check that only the persistent messages are on the Local queue QL.A have survived the restart.
 # amqsbcg QL.A QML00A
  (Non-Persistence Messages will disappear !!! )

[D. Recover a danaged Local Queue from its media image.]
8. Execute rcdmqimg agaist the Queue QL.B . This allows you to see how the record image can force a checkpoint which is useful fir Queues that never (or infrequently) reach a depth of zero where a checkpoint is done automatically.
 # rcdmqimg -m QML00A -t ql QL.B

9. Locate the file implementing Local Queue QL.B within the file system and damage the Queue by deleting the file.
 /var/mqm/qmgrs/QML00A/queues/QL!B/q   (UNIX)
 
 Program Files\IBM\WebSphere MQ\Qmgrs\QML00A\queues\QL!B\Q   (Windows)

10. Display the attributes of Local Queue QL.B using the DISPLAY QUEUE command.
This might still work if the Queue Manager does not need to access the Queue file in order to provide the requested information.
 # runmqsc QML00A
  DISPLAY Q(QL.B)

  DISPLAY Q(QL.B)
   1 : DISPLAY Q(QL.B)
  AMQ8149: WebSphere MQ 物件已損壞。
   [2016, QL.B]
  AMQ8101: 發生 WebSphere MQ 錯誤 (893)。
   [1012, 20]

11. Browse Local Queue QL.B . The Queue Manager should now detect that the Queue has been damaged and report the fact.
 # amqsbcg QL.B QML00A

  AMQSBCG0 - starts here
  **********************
  MQOPEN - 'QL.B'
  MQOPEN failed with CompCode:2, Reason:2101
  MQDISC

[E. Record manually media images to optimize media recovery.]
12. Recover Local Queue QL.B from its media image.
 # rcrmqobj -m QML00A -t ql QL.B

13. Check that you can now again display the attribute of the Queue.
 # runmqsc QML00A
  DISPLAY Q(QL.B)

14. Broswe the Local Queue QL.B again to check if the messages are recovered successfully.
 # amqsgbr QL.B QML00A
 What about the nonpersistent messages ?

15. Get the messages from the Queue.
 # amqsget QL.B QML00A

16. Stop and Delete the Queue Manager.
 # endmqm [-i] QML00A
 # dltmqm QML00A

17. 打完收工! : )

arrow
arrow
    全站熱搜

    amzshar 發表在 痞客邦 留言(0) 人氣()