Blog

    How to Set Up Mirth Connect for High Availability: Failover You Can Test

    By GauravJuly 29, 20269 mins read
    On this page

    How to set up Mirth Connect for high availability is a question about one stopped node: when a restart, a full disk or a dead host takes one engine down, which feeds keep moving? A second server helps only when both nodes share configuration and message history, and when work that must happen once still happens once.

    The guidance is for hospital CTOs, CIOs and digital health founders who own interface uptime, and for the engineers they ask. You get the shared pieces, the jobs that must stay single-runner, and a failover test to run before anyone calls the layout highly available.

    What does high availability mean for Mirth Connect?

    Mirth Connect high availability means more than one server node can keep the interfaces running when one node stops, with channel configuration and message history in one shared database, and with a written test for what still flows after that node stops. Agnotic Technologies treats a failover design as unfinished until that test has been run on the real nodes.

    Test Mirth Connect failover with Agnotic

    Our Mirth Connect page covers channel design, server layout and the failover tests we run with hospital interface teams.

    One promise is that a new connection still receives an acknowledgment after a node stops. Another is that queued messages keep their order and that nothing is read twice. NextGen Healthcare's shared-database layout is what makes the first promise possible. The second depends on which connectors you allow to run on more than one node.

    NextGen Healthcare's Mirth Connect wiki states that multiple Mirth Connect instances can be deployed with one shared database (PostgreSQL, SQL Server, Oracle, MySQL or Amazon Aurora) so channel configuration and message history persist as nodes are added or removed, and that this shared-database layout does not require a separate plugin.

    What has to be shared before a second node helps?

    A second node helps when it uses the same database as the first, so it can read the same channel configuration and the same message history. A second install with its own database is a second engine, and a failure of the first still takes the first engine's feeds with it.

    Point both nodes at that database and confirm the schema matches before production traffic. NextGen Healthcare names PostgreSQL, SQL Server, Oracle, MySQL and Amazon Aurora for this layout. The database team's own backup and failover still apply. The interface engine does not provide them.

    Channels that read the configuration map will see different values on each node when that map still lives on the local disk. Since Mirth Connect 3.6, the configurationmap.location setting can store the map in the shared database. Set it, then change a key on one node and read it on the other before you trust it.

    What is not safe to run on two nodes at once?

    Polling connectors and the data pruner are not safe to run on two nodes at once, and neither is a destination queue that must deliver messages in order. Those jobs have to have a single runner, with a written rule for what happens when that runner stops.

    NextGen Healthcare's Advanced Clustering notes say that without the plugin, channel deployment state stays in memory on each server and queued or unfinished messages from a failed node must be reassigned by hand. With the plugin, polling connectors (File Reader, Database Reader and JavaScript Reader) and the data pruner run on one node. The plugin does not provide a load balancer, does not remove the database as a single point of failure, and does not support no-downtime version upgrades.

    • File Reader, Database Reader and JavaScript Reader: if both nodes poll, the same file or the same row can be taken twice. With the Advanced Clustering plugin, NextGen Healthcare says polling stays on one node and moves to a healthy node if that node fails. Without the plugin, deploy those connectors on one node only, and make the failover test prove the second node did not start polling.
    • Data pruner: two pruners deleting the same message rows fight the database. Run the pruner on one node unless the plugin is coordinating it.
    • Ordered destinations: a queue that must preserve order needs one consumer. Keep it on one node, and write down which node that is and what happens to its queue when that node stops.
    • In-memory deployment state: without the plugin, started and stopped is remembered on each server, not in the database. After a node dies, do not assume the survivor is running the same set of channels until you look.

    How should the sending system reach a live node?

    The sending system should use one address that a live node can answer, because the clustering plugin does not configure a load balancer. You supply that address and you write down which feeds use it. An existing TCP session ends when its node stops, so the failover test includes the sender opening a new session and receiving an acknowledgment from the node that is still up. Round-robin is a poor fit for any connector that must not run twice.

    What should you check when one node stops?

    When one node stops, check that a new message is acknowledged, that polling did not double-read, that queued work followed the rule you wrote down, and that the database is still accepting writes. Check the outcome your design promised, not a different outcome you hoped for.

    Failover layout: one sender, two Mirth Connect nodes and one shared database

    The layout is two engine nodes, one shared database, and one sender using a single address.

    Checks to make after one Mirth Connect node is stopped
    CheckWhat you look atPass
    New connectionA message sent after the stopThe sender gets an acknowledgment from the surviving path
    Queued workMessages that were in flight on the stopped nodeThey resume on a healthy node if you automated recovery, or they are listed for a person to reassign if you did not
    PollingThe file or query the reader was takingThe same item is not processed twice
    PrunerWhich node is deleting old messagesOnly one pruner is running
    DatabaseWrites from the surviving nodeNew message rows commit
    Configuration mapA key the channel readsBoth nodes would see the same value

    If you are not using the plugin, queued messages stay on the node that owned them until a person moves them. The pass is that those messages are visible and that someone on the call knows the reassignment step.

    How do you run a failover test?

    Run a failover test by stopping one engine process while the database stays up, sending a known message, and recording each check in the table above. Stop the process you mean to lose. Do not stop the database in the same test, or you will no longer know which failure you saw.

    • Before the stop: write down queue depths, the last message control id you sent, and which node owns each polling connector.
    • Stop one node. Leave the other node and the database running.
    • Send one known message through the shared address. Record the acknowledgment and which node wrote the message.
    • Confirm the polling source did not emit a second copy, and confirm how many pruners are active.
    • Start the stopped node again. Confirm it does not begin polling a source another node already owns.
    • File the notes with the date, the names of the people on the call, and whether queued messages resumed or waited for a person.

    What is still a single point of failure?

    The shared database is still a single point of failure, and so is a load balancer that itself has only one instance. NextGen Healthcare says the clustering plugin does not remove the database as a single point of failure and does not manage the load balancer. A highly available database is a database-team decision, with its own backup and its own failover test.

    The HIPAA Security Rule contingency plan standard requires a data backup plan, a disaster recovery plan and an emergency mode operation plan for systems that contain electronic protected health information.

    The failover test is evidence beside the emergency mode operation plan. It leaves the backup plan and the disaster recovery plan with the database team. A second engine node cannot rebuild message history that was never backed up. The same notes say the plugin does not support a no-downtime version upgrade, so an upgrade stays its own change, with the sender told.

    What are the common mistakes with Mirth Connect high availability?

    • Two installs with two databases, described as a cluster. A stopped node still takes its own feeds with it.
    • File and database readers deployed on both nodes, so the same file or row is processed twice after a restart.
    • Testing failover by stopping the database and the engine together, so nobody can say which failure the result describes.
    • A round-robin address in front of connectors that must run once or keep order.
    • A failover result from an older engine version or an older sender address, kept as if it still described the live layout.

    Who should sign the failover result?

    The interface owner, the person who runs the servers, and the owner of the sending system should sign the failover result. Each one confirms a different check: channels and queues, the process and the database, and the sender's reconnect.

    • Interface owner: the checks for acknowledgments, queues, polling and the pruner.
    • Server owner: both nodes, the shared address, and the database backup they would actually restore.
    • Sending system owner: their side reconnected and matched the acknowledgment to the message they sent.

    Store the signed note with the channel list.

    When should the failover test be repeated?

    After any change to the nodes, the shared database, the sender address or the engine version. An older result describes a layout you no longer run.

    What should monitoring watch on each node?

    Each node's process, its database connection, and which node holds each polling connector. Alerts name the node, so a quiet second server is noticed.

    What should the runbook say for a node failure at night?

    Who confirms the survivor runs the expected channels, who reassigns queued messages, and who tells the sending system owner.

    When is one node with a fast restart enough?

    When senders queue and retry on their side, and the clinical owners accept the gap a restart causes. Write that acceptance down.

    How can Agnotic help you test Mirth Connect failover?

    Agnotic reviews the shared database, the connectors that must stay single-runner, and the address senders use, then runs the stop-one-node test with your team and writes down the result. We leave you the checklist and the names of the people who watched each side.

    Plan a failover test

    We sit with your interface and server owners, stop one node, and record what still flows.

    Sources

    Frequently Asked Questions

    Hospital CTOs, CIOs and digital health founders whose clinical feeds stop when one engine stops. The interface owner, the server owner and the owner of each sending system should all take part in the failover test.

    Talk to an engineer about your project

    Tell us how many nodes you run and which feeds poll a file or a database. We will list what must not run twice and draft the failover checks.