Chinaunix首页 | 论坛 | 博客
  • 博客访问: 854852
  • 博文数量: 63
  • 博客积分: 1317
  • 博客等级: 中尉
  • 技术积分: 686
  • 用 户 组: 普通用户
  • 注册时间: 2010-11-30 22:07
文章分类

全部博文(63)

文章存档

2015年(4)

2014年(1)

2013年(1)

2012年(2)

2011年(54)

2010年(1)

我的朋友

分类: IT业界

2011-07-31 21:33:55

MQ7.0有一个多实例的新特性,可以实现基于NFS的高可用性。摆脱了以前对于HA软件和文件系统的依赖。使MQ的高可用实现更加简单.
详细信息可参考官方文档:
http://www.ibm.com/developerworks/websphere/library/techarticles/1104_murthy/1104_murthy.html?acss=wmq061611

In this example, Server1 = stallion.in.ibm.com and Server2 = saigon.in.ibm.com.

  1. Create the logs and qmgrs directory in the shared file system:
    # mkdir logs # mkdir qmgrs # chown -R mqm:mqm /HA # chmod -R ug+rwx /HA

  2. Create the queue manager:
    # 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. Copy the queuemanager configuration details from Server1:
    # dspmqinf -o command QM1

  4. Copy the output of the above command to Notepad. The output will be in the following format:
    addmqinf -s QueueManager -v Name=QM1 -v Directory=QM1 -v Prefix=/var/mqm -v DataPath=/HA/qmgrs/QM1

  1. Paste the output of the command was saved in Notepad in Step 4:
    # addmqinf -s QueueManager -v Name=QM1 -v Directory=QM1 -v Prefix=/var /mqm -v DataPath=/HA/qmgrs/QM1 WebSphere MQ configuration information added. #

  2. Start the active instance of queue manager on 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. Start the standby instance of queue manager on 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. Verify the setup using 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) #

In this example, Server1 = lins.in.ibm.com and Server2 = gtstress42.in.ibm.com. On Server 1:

  1. Create a local queue called Q with defpsist(yes).
  2. Create a svrconn channel called CHL.
  3. Start a listener running at port 9898:
    [root@lins ~]# 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 [root@lins ~]# runmqlsr -m SAMP -t tcp -p 9898 & [1] 26866 [root@lins ~]# 5724-H72 (C) Copyright IBM Corp. 1994, 2009. ALL RIGHTS RESERVED.

  4. Set MQSERVER variable on Server1:
    Export MQSERVER=/tcp/ For example: export MQSERVER=CHL/TCP/'9.122.163.105(9898),9.122.163.77(9898)'

  5. On Server 2, start a listener at port 9898:
    [root@gtstress42 ~]# runmqlsr -m QM1 -t tcp -p 9898 & [1] 24467 [root@gtstress42 ~]# 5724-H72 (C) Copyright IBM Corp. 1994, 2009. ALL RIGHTS RESERVED.

Executing the client auto-reconnect samples

  1. Invoke the amqsphac sample program:
    [root@lins ~]# 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. In another window on Server 1, end the queue manager with the -is option so that it will switch over to a standby queue manager:
    Server 1(new session): [root@lins ~]# endmqm -is QM1 WebSphere MQ queue manager 'QM1' ending. WebSphere MQ queue manager 'QM1' ended, permitting switchover to a standby

  3. Verify that a switchover has occurred:
    On Server2: [root@gtstress42 ~]# dspmq -x -o standby QMNAME(QM1) STANDBY(Permitted) INSTANCE(gtstress42.in.ibm.com) MODE(Active) instance.

  4. The connection will break and a reconnection will occur on the standby queue manager:
    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. Run the sample program amsghac on Server 1 to get the messages:
    [root@lins ~]# 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 >

阅读(4030) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~