Saturday, February 1, 2014

Running Multiple Instances of ActiveMQ on the same server

To run multiple instances of Apache ActiveMQ on the same server, it is required to do some configuration changes.

First, go to ActiveMQ installation directory.
cd ~/apache-activemq-5.8.0
Then create instance1 and instance2 by running the following commands.
./bin/activemq create instance1
./bin/activemq setup ~/.activemqrc-instance-instance1
ln -s activemq bin/activemq-instance-instance1

./bin/activemq create instance2
./bin/activemq setup ~/.activemqrc-instance-instance2
ln -s activemq bin/activemq-instance-instance2

ActiveMQ Shell Script doc provides some information on what these commands do. The create command creates a directory called instance1 in the ActiveMQ Home folder which consists of copies of configuration files and links to the binaries. The setup command creates configuration files at ~/.activemqrc-instance-[instancename] which is the required format for running multiple instances.

In addition to that it is required to change the ports used by one of the instances. First change the openwire and amqp ports of instance2 by changing instance2/conf/activemq.xml file.
<transportConnector name="openwire" uri="tcp://;wireformat.maxFrameSize=104857600"/>
<transportConnector name="amqp" uri="amqp://;wireformat.maxFrameSize=104857600"/>

Then change the jetty port used by the ActiveMQ web console of instance2 by editing instance2/conf/jetty.xml as follows.
<bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<property name="port" value="8162" />

Finally the two instances can be started as follows.
./instance1/bin/instance1 console
./instance2/bin/instance2 console 

Source :


Adnan said...

Thank you for valuable information. What i am trying to do is a bit different. I need multiple sessions of APACHE ACTIVEMQ to be running on a server on different ports. Pretty close to what you have listed here, but not exactly the same. I am not familiar with how APACHE works and would like to know how i can go about achieving this.

In short, i need multiple processes of APACHE running on different ports as part of different installations. If i have 5 different processes running i need them to be run through 5 different installations.

Post a Comment