Author Topic: How to find the other HA pair when the Backup is running as Primary?  (Read 1179 times)

Offline oceanblue

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
I am trying to find a way to determine the HA pair of an application.

It is easier when the Original Primary is running in the Primary mode, one can simply construct the "CfgApplicationQuery" to read the application related config object.

However, things are not so trivial (at least to me) when the original Backup app is running as Primary. Any idea how to find the Backup app (original primary) in that case?

Thanks in advance!

Cheers

Offline jamesmurphyau

  • Full Member
  • ***
  • Posts: 117
  • Karma: 2
Re: How to find the other HA pair when the Backup is running as Primary?
« Reply #1 on: July 16, 2019, 06:19:52 PM »
You might be able to do this with an XPath query.. you can do some quite complex queries with XPath.. if I find time and work it out I'll update this post

Offline jamesmurphyau

  • Full Member
  • ***
  • Posts: 117
  • Karma: 2
Re: How to find the other HA pair when the Backup is running as Primary?
« Reply #2 on: July 17, 2019, 09:53:22 AM »
Yep you can do it with XPath

Assume the backup application DBID is 417, the below code will give you the primary for that backup.

Code: [Select]
RequestReadObjects2.create(CfgObjectType.CFGApplication.ordinal, "CfgServer[backupServerDBID/DBID=417]")

Offline hsujdik

  • Sr. Member
  • ****
  • Posts: 378
  • Karma: 15
    • Genesys Brasil
Re: How to find the other HA pair when the Backup is running as Primary?
« Reply #3 on: July 24, 2019, 10:37:06 AM »

Offline jamesmurphyau

  • Full Member
  • ***
  • Posts: 117
  • Karma: 2
Re: How to find the other HA pair when the Backup is running as Primary?
« Reply #4 on: July 24, 2019, 11:52:08 AM »
Actually that's a much better way and it's available natively to CfgApplicationQuery

Code: [Select]
val query = new CfgApplicationQuery();
query.setBackupServerDbid(417);
service.retrieveObject(classOf[CfgApplication], query);

(code is Scala, but same thing applies to Java/.NET)

Offline oceanblue

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Thank you so much @jamesmurphyau and @hsujdik !

My sincere apologies for responding so..so late. I been pulled into a different project.

The "backup_server_dbid" filter along with the setBackupServerDbid() method did it for us.

Thanks again!

cheers,