| Author | Message | 
		
		  | pauline_coffey | 
			  
				|  Posted: Tue Nov 12, 2024 8:51 am    Post subject: How to test which multi instance QM node is active? |   |  | 
		
		  | Novice
 
 
 Joined: 05 Dec 2002Posts: 15
 Location: Dublin, Ireland
 
 | 
			  
				| Hi, 
 I have a simple script to backup my various QMs (just config data) but on a multi-instance QM, how can I tell on which node my QM is running/active?  On my MSCS or PowerHA managed clusters I just rely on dspmq to fail on the inactive nodes but that obviously won't work on the multi-instance QMs.
 
 Thanks,
 Pauline
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | bruce2359 | 
			  
				|  Posted: Fri Nov 15, 2024 10:33 am    Post subject: |   |  | 
		
		  |  Poobah
 
 
 Joined: 05 Jan 2008Posts: 9486
 Location: US: west coast, almost. Otherwise, enroute.
 
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | pauline_coffey | 
			  
				|  Posted: Fri Nov 15, 2024 10:37 am    Post subject: |   |  | 
		
		  | Novice
 
 
 Joined: 05 Dec 2002Posts: 15
 Location: Dublin, Ireland
 
 | 
			  
				| Thanks, the thing is dspmq succeeds (rc=0) on both nodes with or without the -x switch.  I think I will have to beef up my script in some other way rather than rely on an MQ command to fail to infer which node is active (and so which one to backup). |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | fjb_saper | 
			  
				|  Posted: Sat Nov 16, 2024 9:58 pm    Post subject: |   |  | 
		
		  |  Grand High Poobah
 
 
 Joined: 18 Nov 2003Posts: 20767
 Location: LI,NY
 
 | 
			  
				| 
   
	| pauline_coffey wrote: |  
	| Thanks, the thing is dspmq succeeds (rc=0) on both nodes with or without the -x switch.  I think I will have to beef up my script in some other way rather than rely on an MQ command to fail to infer which node is active (and so which one to backup). |  The output of dspmq -x is quite clear on that. Filter on running and check whether the node given is the current node...
  _________________
 MQ & Broker admin
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | pauline_coffey | 
			  
				|  Posted: Sun Nov 17, 2024 12:50 am    Post subject: |   |  | 
		
		  | Novice
 
 
 Joined: 05 Dec 2002Posts: 15
 Location: Dublin, Ireland
 
 | 
			  
				| Yes, thanks. I am using a rather limited Windows shell but will figure something out. |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | bruce2359 | 
			  
				|  Posted: Sun Nov 17, 2024 2:42 pm    Post subject: |   |  | 
		
		  |  Poobah
 
 
 Joined: 05 Jan 2008Posts: 9486
 Location: US: west coast, almost. Otherwise, enroute.
 
 | 
			  
				| 
   
	| pauline_coffey wrote: |  
	| Yes, thanks. I am using a rather limited Windows shell but will figure something out. |  Not sure what this means?   Do you get an error of some kind?  Issuing control commands requires mqm or equivalent authority.
 _________________
 I like deadlines. I like to wave as they pass by.
 ב''ה
 Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | pauline_coffey | 
			  
				|  Posted: Mon Nov 18, 2024 3:08 am    Post subject: |   |  | 
		
		  | Novice
 
 
 Joined: 05 Dec 2002Posts: 15
 Location: Dublin, Ireland
 
 | 
			  
				| Hi, yes, on all my non-MQ managed HA pairs, dspmq fails (rc<>0) on the passive node whereas on an MQ managed HA pair, dspmq will always be successful (rc=0). As I say, I will try something else rather than rely on an MQ command to fail. |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | bruce2359 | 
			  
				|  Posted: Mon Nov 18, 2024 1:04 pm    Post subject: |   |  | 
		
		  |  Poobah
 
 
 Joined: 05 Jan 2008Posts: 9486
 Location: US: west coast, almost. Otherwise, enroute.
 
 | 
			  
				| 
   
	| pauline_coffey wrote: |  
	| Hi, yes, on all my non-MQ managed HA pairs, dspmq fails (rc<>0) on the passive node whereas on an MQ managed HA pair, dspmq will always be successful (rc=0). As I say, I will try something else rather than rely on an MQ command to fail. |  Exactly what command did you enter?  Please include the complete response to your command, not just the return code.
 Exactly what non-zero return code did you receive?
 This https://www.ibm.com/docs/en/ibm-mq/9.2?topic=reference-dspmq-display-queue-managers lists possible return codes.
 
 Return code Description
 
 0	Command completed normally
 5	Queue manager running
 36	Invalid arguments supplied
 58	Inconsistent use of installations detected
 71	Unexpected error
 72	Queue manager name error
 _________________
 I like deadlines. I like to wave as they pass by.
 ב''ה
 Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | gbaddeley | 
			  
				|  Posted: Mon Nov 18, 2024 4:30 pm    Post subject: |   |  | 
		
		  |  Jedi Knight
 
 
 Joined: 25 Mar 2003Posts: 2538
 Location: Melbourne, Australia
 
 | 
			  
				| 
   
	| pauline_coffey wrote: |  
	| Thanks, the thing is dspmq succeeds (rc=0) on both nodes with or without the -x switch.  I think I will have to beef up my script in some other way rather than rely on an MQ command to fail to infer which node is active (and so which one to backup). |  You should rely on IBM MQ commands. Custom script code might fail at some point in the future when IBM decide to change how things work under the covers, whereas the behavior of a MQ command will be consistent and documented.
 _________________
 Glenn
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | pauline_coffey | 
			  
				|  Posted: Tue Nov 19, 2024 1:11 am    Post subject: |   |  | 
		
		  | Novice
 
 
 Joined: 05 Dec 2002Posts: 15
 Location: Dublin, Ireland
 
 | 
			  
				| Hi Bruce, I'm now happy to solve myself, but just to show you what I mean:
 
 C:\windows\system32>dspmq -x -m QM01
 QMNAME(QM01)                                 STATUS(Running as standby)
 INSTANCE(AZ01) MODE(Active)
 INSTANCE(AZ02) MODE(Standby)
 
 C:\windows\system32>echo %errorlevel%
 0
 
 C:\windows\system32>dspmq -m QM01
 QMNAME(QM01)                                 STATUS(Running as standby)
 
 C:\windows\system32>echo %errorlevel%
 0
 
 C:\windows\system32>dspmq -x -m QM02
 AMQ7048E: The queue manager name is either not valid or not known.
 
 C:\windows\system32>echo %errorlevel%
 72
 
 These rc's are perfectly reasonable, but I was just hoping for an easy solution to determine which was the active MQ node in an MQ managed cluster from a primitive Windows batch file - on MSCS managed nodes, dspmq will fail on the passive node.
 
 Thanks for the responses in any case.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | gbaddeley | 
			  
				|  Posted: Tue Nov 19, 2024 8:35 pm    Post subject: |   |  | 
		
		  |  Jedi Knight
 
 
 Joined: 25 Mar 2003Posts: 2538
 Location: Melbourne, Australia
 
 | 
			  
				| I don't have any MIQM to try this out. Does the -a parameter assist?
 The errorlevel should be 5 if the qmgr is running locally, or 0 if not running locally.
 Without -a, it returns errorlevel 0 in both cases.
 
 Not sure if a MIQM "running as standby" is treated as a locally running qmgr.
 
 Refer to the Return Codes on https://www.ibm.com/docs/en/ibm-mq/9.4?topic=reference-dspmq-display-queue-managers
 _________________
 Glenn
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  |  |