Skip to content

OneLastTry/hc-mirror-sample-public

Repository files navigation

InterSystems HealthShare Health Connect Mirror Sample

Architecture

This document will describe how to configure mirror for a new deployment of Health Connect and how mirrored namespaces should be created. The architecture includes a ha_proxy deployment working as a load balancer, 2 web gateways that are mirror aware, 1 mirror pair and a dedicated web gateway for each node and the arbiter. For the sake of easy reproducibility, this guide uses a container deployment. However, with exception of specific docker commands, everything should work for different types of deployments.

architecture

Note that this document will not provide steps to installing Health Connect.

Constraints for Using the Containers

To fully execute this tutorial in containers:

  • You must have a valid Health Connect container license key. Once you have the license, copy the file to ./license/iris/<architecture>/ saved as iris.key
  • You must have access to containers.intersystems.com, simply log with your InterSystems credentials and copy & paste the Docker login command into the terminal.

login

Otherwise you can follow the steps on your local deployment.

Running the Container

To run the container using docker compose, first make sure to clone the repo, then execute below from the project root directory:

# for x64 architecture
docker compose up -d    # to start the container detached
docker compose down -v  # to stop and remove the container

# for arm64 architecture
docker compose --env-file=.env-arm64 up -d    # to start the container detached
docker compose --env-file=.env-arm64 down -v  # to stop and remove the container

Local Access Shortcuts

When you environments are running, you can access it from the links below:

Mirror Configuration

This section follows the Configuring Mirroring documentation.

Mirror Aware Web Gateway

The mirror aware configuration is done via the CSP.ini parameter Mirror_Aware and can be found in CSP-000.ini and CSP-001.ini:

[REMOTE]
Ip_Address=healthconnect-0
TCP_Port=1972
Username=SuperUser
Minimum_Server_Connections=3
Maximum_Session_Connections=3
Password=]]]U1lT
Mirror_Aware=1

Mirror Through CPF Merge

There are different techniques that allow automatic mirror configuration at the instance level by leveraging the configuration merge (CPF merge). In this example we Deploy the Mirror Using Hostname Matching.

Looking at the architecture, we have two Health Connect instances:

  • healthconnect-0
  • healthconnect-1

The merge-mirror.cpf contains a line that can leverage the naming convention and automatically deploy mirror. The same CPF merge is applied to both instances and they get configured following the behavior described in the documentation with a mirror set named HEALTHCONNECT. In addition to that, another line to enable ECP is also part of the file.

ConfigMirror:Name=HEALTHCONNECT,Map="primary,backup",Member=auto,Primary=auto,ArbiterURL=arbiter:2188

mirror-conf

For more information on general CPF merge, see Automating Configuration of InterSystems IRIS with Configuration Merge.

Mirror HSSYS

To leverage the automation of mirrored namespaces creation from HealthShare products (including Health Connect) on later stages, we need to mirror HSSYS database. See Configuring Mirroring for Healthcare Products.

HSSYS database comes with all healthcare products and, as of the date of this guide, there is no automated way of mirroring it without having to move database files at the OS level, which requires manual or scripted intervention.

  1. Added HSSYS to mirror set on the primary node

    Go to HSSYS Database Properties on System Administration → Configuration → System Configuration → Local Databases → HSSYS and click Add to Mirror HEALTHCONNECT, after you are done you should see the mirror set assigned to HSSYS (second screenshot).

    hssys-1

    hssys-2

  2. Dismount HSSYS on the primary node

    Go to HSSYS Database Details on System Operations → Databases → HSSYS and click Dismount.

    hssys-3

  3. Copy HSSYS.DAT from the primary node to the backup node

    From your operating system terminal execute the command below to enter the primary node container.

    docker exec -it healthconnect-0 bash

    The directory /tmp is shared between healthconnect-0 and healthconnect-1, so we will copy the file there first

    From the container terminal we just got access to, run the command below to copy the database.

    cp -p /usr/irissys/mgr/hssys/IRIS.DAT /tmp/. && exit
  4. Remount HSSYS on the primary node

    Go to HSSYS Database Details on System Operations → Databases → HSSYS and click Mount.

    hssys-4

  5. Dismount HSSYS on the backup node

    Go to HSSYS Database Details on System Operations → Databases → HSSYS and click Dismount.

    hssys-5

  6. Copy the primary HSSYS.DAT from the shared directory to the backup node

    From your operating system terminal execute the command below to enter the backup node container.

    docker exec -it healthconnect-1 bash

    From the container terminal we just got access to, run the command below to copy the database.

    mv /tmp/IRIS.DAT /usr/irissys/mgr/hssys/IRIS.DAT && exit
  7. Remount HSSYS on the backup node

    Go to HSSYS Database Details on System Operations → Databases → HSSYS and click Mount.

    hssys-6

  8. Activate & Catchup HSSYS on the backup node

    Go to Mirror Monitor on System Operations → Mirror Monitor and click Activate. Once is activated click on Catchup.

    hssys-7

    hssys-8

Network Host Name to VIP or Load Balancer

Still following Configuring Mirroring for Healthcare Products, we now need to update Network Host Name to be the VIP or the Load Balancer, in our case we have a load balancer called loadbalancer.

On the primary node, go to the Installer Wizard on Health → Installer Wizard and click Configure Network Host Name. Change the Network Host Name value to loadbalancer and save.

network

HS_Services

Make sure that HS_Services user is active and has a valid password when creating new namespaces. See Predefined User Accounts

Activate Mirror Monitor Launch Task

The last step is to activate a task that keeps IRISSYS (which is not mirrored) synced on the backup member. For more, see Mirroring Considerations for Healthcare Products.

From your operating system terminal execute the command below to enter the IRIS terminal in the backup node container.

docker exec -it healthconnect-1 iris terminal iris -U HSLIB

Then run the command to configure the task.

do ##class(HS.Util.Mirror.Task).Schedule("HSSYS")
h

Once the command above is executed you can see the task in the Task Schedule of the backup node.

task-1

Give it a couple of minutes for the task to run once is configured.

Creating a Namespace (AKA: The Cool Stuff)

Now that mirror is configured, we can create namespaces that are automatically mirrored.

Create a Foundation Namespace on the Primary Node

Go to the Installer Wizard on Health → Installer Wizard and click Configure Foundation. In there, update the Local Name to MIRRORED and tab out, the rest will be automatically populated. Make sure that Mirror Database is checked and save.

mirrored-1

Activate the Namespace

Still from the Installer Wizard screen, click in Activate for the MIRRORED entry that was just created. After the execution is complete, you should see that activation was successful.

mirrored-2

mirrored-3

When looking at the backup Mirror Monitor on System Operations → Mirror Monitor, you can confirm that the database is configured.

mirrored-3

Optional

Play around with starting a production and failing over to observe the behavior.

To failover, from your operating system terminal execute the command below to enter the primary node container.

docker exec -it healthconnect-0 bash

Then run the command to restart the instance.

iris restart iris

You should notice that when accessing the load balanced SMP healthconnect-1 became the primary and load balancing works fine.

failover

Bonus

For this container deployment, if you want to have everything configured in a scripted way, update Custom.Loader.cls by changing AUTOMIRROR from 0 to 1, save and restart your containers (down and up -d again). This will execute the exact same steps above (allow a few minutes for the script to run). To explore the script, see Custom.AutoMirror.cls.

/// Parameter AUTOMIRROR = 0;
Parameter AUTOMIRROR = 1;

...

About

InterSystems HealthShare Health Connect Mirror Sample

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors