high-availabilityactivemq-artemisfailovervirtual-ip-address

ActiveMQ Artemis - how to configure primary/backup on two VMs with replication only (no failover)


In ActiveMQ Artemis, I'm wondering if it's possible to enable replication only between two nodes, and have some outside mechanism inform the Active MQ Artemis processes living on each node which is the primary. In other words, the election of the primary is handled by an outside application which informs Artemis of its status.

More specifically, the environment our current HA solution is deployed in has a virtual IP address which directs traffic to one of two VMs based on their availability. i.e., if one is down, it directs traffic to the other, with only one VM receiving data at any given time.

If there is some kind of hook into the virtual IP mechanism, we could theoretically have it tell a listening process on each of the VMs if it the active receiver. That process could then tell ApacheMQ Artemis "you are the primary" or "you are the secondary".

Assuming the hook is available, is it possible to enable this functionality in Artemis? i.e., replication between two VMs only, and have an outside process lit it know which is available?


Solution

  • ActiveMQ Artemis replication configuration requires identifying the primary and the backup explicitly. There is no way for an external entity to specify which broker is the primary and which broker is the backup.

    However, it's still possible for the virtual IP address to direct traffic to one of the two VMs based on the broker's availability since the backup broker will not be able to receive connections until the primary broker fails at which point the backup broker will become active and begin accepting connections.