While using AMQ, one technique to avoid a single point of failure is to set up a master-slave topology. In a master-slave configuration, a set of brokers cooperate to ensure that the cluster does not go down. It is an active-passive configuration, where the master and slaves synchronize themselves using various locking mechanisms: shared filesystem, shared database, replicated stores, colocated, and so on. The master should always be active to maintain the cluster is up and running. Once the master goes down, a slave node immediately detects the breakdown and becomes the new master node. In such a configuration, clients have to adjust the calling URL with the failover URL to automatically switch to the new broker:
To build a master-slave configuration from the existing standalone instances--broker1(127.0.0.2) and broker2(127.0.0.3)--we need to update broker.xml...