Written by

Solution Architect at Zorgi
MOD
Question Lorenzo Scalese · May 6, 2021

Install ZMIRROR Routine

Go to the original post@Lorenzo Scalese

Hi,

Question about ZMIRROR routine.

I analyze a problem with the label NotifyBecomePrimary. It seems not performed after a switch.

After installing ZMIRROR routine in %SYS, is a restart required?
If It's required, It could be explain my problem.

Thank you.

Product version: HealthShare 2018.1

Comments

Lorenzo Scalese · May 6, 2021

Solved.
Finally, It was simple.
The routine has been installed after the switch, but before my investigation.
So, I thought the routine was there and not performed.

0
Scott Roth · Mar 1, 2023

@Lorenzo Scalese 
How did you configure/install ZMIRROR? Where does it need to be put for the system to recognize it needs to run? I understand what ZMIRROR does, just looking for examples.

0
Lorenzo Scalese  Mar 1, 2023 to Scott Roth

Hi @Scott Roth ,

The routine ZMIRROR.MAC must be installed in the namespace "%SYS" on each failover member.  It needs the IRISLIB database mounted in RW for installation.

I use ZMIRROR.MAC to execute code when a node becomes primary, in my example I just implement "NotifyBecomePrimary" label :

ZMIRROR
    Quit
    
NotifyBecomePrimary()
    New; https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GHA_mirror#GHA_mirror_set_tunable_params_zmirror_routineTry {
        
        Set ns = "MYAPPNAMESPACE"If##class(Config.Namespaces).Exists(ns) {
            JOB##class(pkg.Class).ClassMethod():(ns):2
        }
        
    } Catch(ex) { } ; just a securityQuit:$Quit1Quit

There are many events available, we can see the list on this documentation page .
What event mirror are you interested in?
 

0
Scott Roth  Mar 1, 2023 to Lorenzo Scalese

Thanks this gives me some guidance along with other examples I have gotten. NotifyBecomesPrimary is the one I’m most looking at right now. Once that hits then I’m going to call a shell script through $ZF to execute. 

0