Friday, May 10, 2013

Step by step guide to configure multiple ActiveMQ instances in one Server


Step by step guide to configure multiple ActiveMQ instances in one Server:

Prerequisites:
1. Download ActiveMQ binary file
(ex: apache-activemq-5.4.2-bin.tar.gz from http://activemq.apache.org/activemq-542-release.html)
2. untar the .tar.gz file
tar -zxvf apache-activemq-5.4.2-bin.tar.gz

Create and Start instance 1:
1.  Navigate to ActiveMQ folder:
cd /home/test/apache-activemq-5.4.2
2. Create an ActiveMQ instance as instance1:
bin/activemq create instance1
(This will create a folder as instance1: "/home/test/apache-activemq-5.4.2/instance1")
3.  bin/activemq setup ~/.activemqrc-instance-instance1
4.  ln -s activemq bin/activemq-instance-instance1
5.  Give executable permission to instance:
chmod 755 instance1/bin/instance1
6.  cd instance1/bin (i.e: /home/test/apache-activemq-5.4.2/instance1/bin)
7.  Start intsnace1
./instance1 console

Create and Start instance 2:
8.   cd /home/test/apache-activemq-5.4.2
9.   bin/activemq create instance2
10. bin/activemq setup ~/.activemqrc-instance-instance2
11. ln -s activemq bin/activemq-instance-instance2
12. chmod 755 instance2/bin/instance2
13. Edit activemq.xml file and jetty.xml in /<instance>/conf folder
  • cd instance2 (i.e: /home/test/apache-activemq-5.4.2/instance2)
  • vi conf/activemq.xml
  • Edit “transportConnectors” port:
    (ex:<transportConnector name="openwire" uri="tcp://0.0.0.0:61617"/>)
Default setting as follows:
<transportConnectors> <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/> </transportConnectors>
  • save and exit

  • vi conf/jetty.xml
  • Edit “Connector” port
    (ex: <property name="port" value="8162" />
Default setting as follows:
<property name="connectors"> <list>
<bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<property name="port" value="8161" />
</bean>
</list>
</property>
  • save and exit
14. cd instance2/bin (i.e: /home/test/apache-activemq-5.4.2/instance2/bin)
15. Start intsnace2
./instance2 console

Note: Any number of instances can be configured and started accordingly. 

No comments:

Post a Comment