Christian Posta bio photo

Christian Posta

Chief Architect, cloud application development @ Red Hat, author Microservices for Java Developers, open-source enthusiast, committer @ Apache, Cloud, Integration, Kubernetes, Docker, OpenShift, Fabric8, #blogger

Twitter Google+ LinkedIn Github Stackoverflow

So I haven't been blogging as much recently -- just been really busy. But my New Year's resolution is to blog a little more sharing some things I come across frequently, even if it's simple stuff that might help some people out.

So for this entry, I'll show a quick way to start up multiple JBoss A-MQ instances on a single machine. The reason why this question comes up is because JBoss A-MQ includes a little more "enterprise" ready features out of the box than plain old community ActiveMQ. JBoss A-MQ is a production-ready, hardened, version of ActiveMQ, and it's packaged inside Apache Karaf with some other features like the HawtIO console (and more).

What happens when people are trying to simulate more complex deployment scenarios in a lab or development environment, they may not have access to multiple VMs or machines to try out a full real-world deployment. So they may want to install multiple brokers on a single box. This is pretty straight forward, and all you have to do is make sure the default ports don't conflict. NOTE: this is not intended to be a production deployment!!! Don't deploy this way to production!!

You can get pretty wacky and customize each additional A-MQ/Karaf JVM with the Karaf admin commands but if you want to just get something working and want to understand where the port conflicts can be, check this out:

Download JBoss A-MQ

Go to the Red Hat support portal (or and download the copy of JBoss A-MQ you want to use. Note, the bits are the same from whichever website you download from, but you need a valid subscription to use in any shared environments (anything excluding your development laptop).

For this exercise, we're using JBoss A-MQ 6.1 (filename

Install into two locations

If we want to have two separate JBoss A-MQ brokers, let's start by unpacking into two separate locations:

~> unzip -d amq01
~> unzip -d amq02

Now in each installation path (eg, ./amq01/jboss-a-mq-6.1.0.redhat-379), which we'll call the broker's BASE directory, find the files in the $BASE/etc folder with the name Uncomment the last line in that file so we have an admin user.

Change ports

Last step we need to do is change the ports in the installation for amq02 so they don't conflict.

There are three files we'll need to touch, which are the config PIDs for the services that run in the container.


In this file, edit the following properties:

rmiRegistryPort = 1098  #default is 1099
rmiServerPort = 44445   #default is 44444

Note, those are the changed values. You can change them to whatever you want.


In this file, edit the following properties:

sshPort = 8102  #default is 8101


And lastly, in this file, edit:

org.osgi.service.http.port=8182   #default is 8181
activemq.port = 61617   #default is 61616

Start up your brokers

Go and start up your brokers with $BASE/bin/amq script, and you should have two running brokers, without collisions on ports.