Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • JAVA_HOME at the monitored hosts
  • MZ_HOME of containers
  • HA ports of pico instances

 


The HA script interface with the HA Monitor Server

 


The monitor script interfaces the HA Monitor Server of a pico instance. By default, the scripts uses the following exit codes:

  • 100  - ha.jar error returned non-zero value, indicating failed instance
  • 110 - ha.jar returned 0 (zero), indicating healthy instance

Extracting the HA Scripts

The scripts files are stored in file in MZ_HOME/ha. Run the following command to extract the files:

Code Block
languagetext
themeEclipse
$ tar -xvf $MZ_HOME/ha/ha.tar

Using the HA Scripts

This is the communication between the HA Monitor Server and the CMS in detail:

  1. The CMS executes the monitor script. 

    Code Block
    languagetext
    themeEclipse
    $ ./monitor <$JAVA_HOME> <$MZ_HOME> <username> <mz.ha.port> [host] [sec_timeout] [debug]

    The username argument is included for use in modified monitor scripts. 

    By default, the host argument is omitted, this will cause the HA Client to connect to localhost.

    Use the optional argument sec_timeout to specify a timeout threshold, for the response from the HA Monitor Server. For additional debug information on stdout add the argument debug.  


  2. The monitor script calls the HA Client to pull the HA monitor server for information about the pico instance. 

    Code Block
    languagetext
    themeEclipse
    ...
    # Execute the ping command
    
    $java_home/bin/java -cp $mz_home/lib/ha.jar com.digitalroute.ha.HAClient $port $@ 2>&1
    
    ...


  3. The monitor script uses the status from ha.jar to return the appropriate exit code to the CMS.

    Code Block
    languagetext
    themeEclipse
    ...
    # Collect the result
    
    result=$? 
    
    # If the result differ from "0" then the command failed.
    
    if [ "$result" != "0" ] ; then
    
        echo "FAILED"
    
        exit 100
    
    else
    
        echo "OK"
    
        exit 110
    
    fi
    ...


  4. The CMS acts upon this information. In case of failure (indicated by exit code), the offline scripts followed by the clean script should be executed. 

    Code Block
    languagetext
    themeEclipse
    $ ./offline <$JAVA_HOME> <$MZ_HOME> mzadmin <pico> ...
    $ ./clean <$JAVA_HOME> <$MZ_HOME> mzadmin <pico> ...

    The offline script is used to gracefully stop the pico instances. It must be executed when the Platform availability evaluation fails.

    The clean script is used to terminate the pico instances immediately and should always be used if the offline script fails. It will also attempt to remove any terminated SCs, from Akka clusters by calling the mzsh command akka down.  

     


  5. The CMS executes the online script to start a new pico instance, e g in a different container.

    Code Block
    languagetext
    themeEclipse
    $ ./online <$JAVA_HOME> <$MZ_HOME> mzadmin <pico> ...


Note
titleNote!

The provided scripts should be seen as templates that must be modified for different types of CMS products.

Consider the following when adjusting the scripts:

  • Measure the response time from the HA Monitor Servers for different load conditions to be able to distinguish between unavailable and heavily loaded pico instances.
  • When starting a failed EC/ECSA, scheduled workflows will be executed according to the schedule.

The HA Monitor Server Interface

You can communicate with a HA Monitor Server via telnet. The following commands are supported:

CommandDescription
helpLists the available commands
ping <pico_name>Checks the pico client(s) for availability.
quitCloses the connection
exitCloses the connection