Amarjit Dhillon
Amarjit Dhillon

Reputation: 2816

Multiple instances of ActiveMQ starts causing issues

When I try to start ActiveMQ it gives me a process with new pid and new pidfile. So what happens to old pid and old pidfile. Also, sporadically it says that an instance is active. I am using Mac OS X.

amar@admin:~$ activemq start
INFO: Loading '/usr/local/Cellar/activemq/5.15.4/libexec//bin/env'
INFO: Using java '/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/usr/local/Cellar/activemq/5.15.4/libexec//data/activemq.pid' (pid '12637')
amar@admin:~$ activemq start
INFO: Loading '/usr/local/Cellar/activemq/5.15.4/libexec//bin/env'
INFO: Using java '/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/usr/local/Cellar/activemq/5.15.4/libexec//data/activemq.pid' (pid '12730')
amar@admin:~$ activemq start
INFO: Loading '/usr/local/Cellar/activemq/5.15.4/libexec//bin/env'
INFO: Using java '/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/usr/local/Cellar/activemq/5.15.4/libexec//data/activemq.pid' (pid '12815')
amar@admin:~$ activemq start
INFO: Loading '/usr/local/Cellar/activemq/5.15.4/libexec//bin/env'
INFO: Using java '/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java'
INFO: Process with pid '12815' is already running
amar@admin:~$ activemq start
INFO: Loading '/usr/local/Cellar/activemq/5.15.4/libexec//bin/env'
INFO: Using java '/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/usr/local/Cellar/activemq/5.15.4/libexec//data/activemq.pid' (pid '12982')

Upvotes: 0

Views: 271

Answers (1)

user9968345
user9968345

Reputation: 26

If you run activemq start multiple times, it will kick off multiple JVMs to run the broker. However since you did not specify any unique broker configuration, each instance will use the same default broker configuration from conf/activemq.xml. And that typically means each broker instance will compete for the lock on the default KahaDB store. Only one instance will get the lock on that store and fully start up (the master broker), the other instances will continue to compete for the lock (slave brokers).

This way of running multiple brokers may be okay for testing purposes but should not be done in any real environment, as each instance also writes to the same log file. For real master/slave deployments, you typically run brokers on multiple different servers/VM and they typically share the same persistence store via a mounted network drive.

Hope that helps. Torsten

Upvotes: 1

Related Questions