Deployment configuration details for distributed ActiveMQ clusters:
Official information: http://activemq.apache.org/clustering.html
Basically look at this is enough, this article does not specifically analyze the configuration file.
1.Queue consumer clusters:
The same queue, if a consumer fails, the unacknowledged message is sent to the other queue's on the consumer. If a consumer processes messages faster, it will process more messages.
The Queue consumer clusters does not require a special configuration.
2. High Availability of Master-slave:
The main goal is to achieve high availability and fault tolerance for AMQ, and if a broker hangs, it needs to wait for it to restart to continue processing messages. If the message is copied to slave , You can switch directly to slave when master hangs, causing the message not to be lost. It is divided into 3 different forms:
(1) Pure Master-slave.
This approach has gradually been phased out: http://activemq.apache.org/pure-master-slave.html
(2) Shared File System Master Slave.
Official information: http://activemq.apache.org/masterslave.html
With shared file system: When AMQ is deployed on multiple machines , specify a shared file path for these machines as storage.
Storage defaults to AMQ -based kahadb ( the underlying file system ) implementation.
When aAMQThe instance obtains the lock of the shared file, which becomes theMaster, the other instance isSlave. If thisMasterhang up, otherAMQThe instance competes for the lock of the shared file, and the lock becomesMaster, other instances areSlave. When you deploySlaveNo Limit number, and automatic switchingMasterNo manual intervention is required. (The official information has the detailed process picture introduction)
(3) JDBC Master Slave.
Official information: http://activemq.apache.org/masterslave.html
In fact , just like the shared file system, the shared filesystem is replaced with a database as storage. Convenient and practical, but to ensure high availability of the database.
3 . Static and dynamic discovery in Broker Cluster :
How do you get a broker to know more than one broker on the network ? There are two types of static discovery and dynamic discovery:
(1) The static Transport ( still found, including the failover protocol ).
Official information: http://activemq.apache.org/static-transport-reference.html
Static discovery: This is the manual configuration of all known broker URIs , and the client -side URI addresses are modified accordingly.
About failover: When a client connects to a broker, the broker The client will need to automatically connect to other known Broker on.
AMQ uses the failover Protocol to implement this functionality , but requires that all broker Configured in hard-coded form.
Failover Agreement official information:http://activemq.apache.org/failover-transport-reference.html
(2) The Discovery Transport ( dynamic Discovery ).
Official information: http://activemq.apache.org/static-transport-reference.html
The so-called dynamic discovery, is not need to know all the AMQ instance URI address before deployment, as long as the relevant configuration, start to let AMQ self detection.
The AMQ configuration file needs to be modified, and the client connection URI address should be modified accordingly.
4. Network ofBroker:
The main purpose is to achieve load balancing and improve the ability of message processing.
Oneclient1ConnectionBroker1send Message, anotherClient2ConnectionBroker2consumer messages, you will need toBroker1on the message route to theBroker2on. And whenBroker2on theConsumeralso need to forward messages to otherConsumerof theBrokerTo prevent a large backlog of messages from being processed, the current solution isNetwork of Broker.
Official information: http://activemq.apache.org/networks-of-brokers.html
This article mainly to ActiveMQ distributed cluster related knowledge to summarize, the specific configuration process see above official information, very detailed.
Some good references on the Internet:
Http://www.doc88.com/p-086413647667.html
Http://wenku.baidu.com/view/d0cd7757ad02de80d4d8408a.html
http://bh-keven.iteye.com/blog/1617788
Distributed ACTIVEMQ clusters