Este contenido no está disponible en el idioma seleccionado.
8.4.4. ActiveMQ
ActiveMQ uses the term broker to identify an ActiveMQ server. However, this section distinguishes ActiveMQ brokers from OpenShift Enterprise broker hosts.
Because ActiveMQ services can be configured for redundancy, this section demonstrates redundancy with three servers to configure a redundant network of ActiveMQ brokers. This configuration provides the following advantages:
- Distributes queues and topics among ActiveMQ brokers
- Allows clients to connect to any Active MQ broker on the network
- Failover to another ActiveMQ broker if one fails
Connecting all ActiveMQ brokers to each other achieves this redundancy. See the following ActiveMQ documentation for more background information:
- Clustering - http://activemq.apache.org/clustering.html
- How do distributed queues work - http://activemq.apache.org/how-do-distributed-queues-work.html
8.4.4.1. Configuring a Network of ActiveMQ Brokers Copiar enlaceEnlace copiado en el portapapeles!
Copiar enlaceEnlace copiado en el portapapeles!
This section describes how to configure a network of ActiveMQ brokers, and the example instructions show a configuration of three ActiveMQ brokers found on the following hosts:
activemq1.example.comactivemq2.example.comactivemq3.example.com
Use the same configuration for all hosts, but substitute specific information to suit the requirements of each host.
Networked ActiveMQ brokers are configured differently from what is described in the basic installation. The following procedure describes how to configure a network of ActiveMQ brokers.
Procedure 8.14. To Configure a Network of ActiveMQ Brokers:
- Install ActiveMQ with:
yum install -y activemq
# yum install -y activemqCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Modify the
/etc/activemq/activemq.xmlconfiguration file. Red Hat recommends downloading and using the sampleactivemq.xmlfile provided at https://raw.github.com/openshift/openshift-extras/enterprise-2.2/enterprise/install-scripts/activemq-network.xml as a starting point. Modify the host names, user names, and passwords to suit your requirements.However, if you choose to modify the default/etc/activemq/activemq.xmlconfiguration file, use the following instructions to do so. Each change that must be made in the default/etc/activemq/activemq.xmlfile is described accordingly. Red Hat recommends that you create a backup of the default/etc/activemq/activemq.xmlfile before modifying it, using the following command:cp /etc/activemq/activemq.xml{,.orig}# cp /etc/activemq/activemq.xml{,.orig}Copy to Clipboard Copied! Toggle word wrap Toggle overflow - In the
brokerelement, modify thebrokerNameanddataDirectoryattributes, and adduseJmx="true":<broker xmlns="http://activemq.apache.org/schema/core" brokerName="activemq1.example.com" useJmx="true" dataDirectory="${activemq.base}/data"><broker xmlns="http://activemq.apache.org/schema/core" brokerName="activemq1.example.com" useJmx="true" dataDirectory="${activemq.base}/data">Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Modify the
destinationPolicyelement:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Comment out or remove the
persistenceAdapterelement, and replace it with thenetworkConnectorselement. This example is for the first ActiveMQ broker.Copy to Clipboard Copied! Toggle word wrap Toggle overflow ThenetworkConnectorselement provides one-way message paths to other ActiveMQ brokers on the network. For a fault-tolerant configuration, thenetworkConnectorelement for each ActiveMQ broker must point to the other ActiveMQ brokers, and is specific to each host. In the example above, theactivemq1.example.comhost is shown.EachnetworkConnectorelement requires a unique name and ActiveMQ broker. The names used here are in thelocalhost -> remotehostformat, reflecting the direction of the connection. For example, the first ActiveMQ broker has anetworkConnectorelement name prefixed withbroker1-broker2, and the address corresponds to a connection to the second host.TheuserNameandpasswordattributes are for connections between the ActiveMQ brokers, and match the definitions described in the next step. - Add the
pluginselement to define authentication and authorization for MCollective, inter-broker connections, and administration purposes. Thepluginselement must be after thenetworkConnectorselement. Substitute user names and passwords according to your local IT policy.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Add the
stomptransportConnector(for use by MCollective) to thetransportConnectorselement. TheopenwiretransportConnectoris used for ActiveMQ inter-broker transport, and must not be modified. Configure thetransportConnectorselement as shown in the following example.<transportConnectors> <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/> <transportConnector name="stomp" uri="stomp://0.0.0.0:61613"/> </transportConnectors>
<transportConnectors> <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/> <transportConnector name="stomp" uri="stomp://0.0.0.0:61613"/> </transportConnectors>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
- Secure the ActiveMQ console by configuring Jetty, as described in the basic installation.
- Enable authentication and restrict the console to
localhost:cp /etc/activemq/jetty.xml{,.orig} sed -i -e '/name="authenticate"/s/false/true/' /etc/activemq/jetty.xml# cp /etc/activemq/jetty.xml{,.orig} # sed -i -e '/name="authenticate"/s/false/true/' /etc/activemq/jetty.xmlCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Change the default
adminpassword in the/etc/activemq/jetty-realm.propertiesfile. The password is the same as theadminpassword in the authentication plug-in.cp /etc/activemq/jetty-realm.properties{,.orig} sed -i -e '/admin:/s/admin,/password,/' /etc/activemq/jetty-realm.properties# cp /etc/activemq/jetty-realm.properties{,.orig} # sed -i -e '/admin:/s/admin,/password,/' /etc/activemq/jetty-realm.propertiesCopy to Clipboard Copied! Toggle word wrap Toggle overflow
- Modify the firewall to allow ActiveMQ
stompandopenshifttraffic:lokkit --port=61613:tcp lokkit --port=61616:tcp
# lokkit --port=61613:tcp # lokkit --port=61616:tcpCopy to Clipboard Copied! Toggle word wrap Toggle overflow The basic installation only opens port 61613. Here, port 61616 has also been opened to allow ActiveMQ inter-broker traffic. - Restart the ActiveMQ service and make it persistent on boot:
service activemq restart chkconfig activemq on
# service activemq restart # chkconfig activemq onCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Note
If you use the kickstart bash script, the
configure_activemq function performs these steps when multiple members are specified with CONF_ACTIVEMQ_REPLICANTS.