Hi, I’ve narrowed this down to the schedulerSupport attribute.. We delay 
sending some messages so that is set to true.. When I set it to false the 
broker will start as the master when using systemctl.

I still don’t understand why it starts as slave because that is set to true.


This config will start as slave when using systemctl(works fine on the command 
line)
  <broker xmlns="http://activemq.apache.org/schema/core"; 
     useJmx="true"
        persistent="true" 
        dedicatedTaskRunner="false" 
        schedulerSupport=“true"
        brokerName="broker-persistent”>


This will start correctly in systemctl and on the command line
  <broker xmlns="http://activemq.apache.org/schema/core"; 
     useJmx="true"
        persistent="true" 
        dedicatedTaskRunner="false" 
        schedulerSupport="false"
        brokerName="broker-persistent">
Dan Cosio

 Wired Informatics
265 Franklin St Ste 1702
Boston, MA 02110
http://wiredinformatics.com
[email protected]




> On Oct 13, 2021, at 1:11 AM, Tim Bain <[email protected]> wrote:
> 
> Is your systemctl-launched ActiveMQ running as root or another user? Can that 
> user manually create that file from the command line?
> 
> When the file is created under systemctl, is it owned by the user the broker 
> is running as? Are you able to tell which process created the lock file? Does 
> any process have the lock file open? If so, is it your broker?
> 
> Is the filesystem the lock file lives on a network filesystem or a local one? 
> If remote, what NFS version does it use? 
> 
> Tim 
> 
> On Mon, Oct 11, 2021, 8:27 AM Dan Cosio <[email protected] 
> <mailto:[email protected]>> wrote:
> This is the only java process running on the machine.. this only happens when 
> starting the broker using systemctl..If I start it using sudo -u on the 
> command line it starts up as expected(no slave mode)
> Dan Cosio
> 
>  Wired Informatics
> 265 Franklin St Ste 1702
> Boston, MA 02110
> http://wiredinformatics.com <http://wiredinformatics.com/>
> [email protected] <mailto:[email protected]>
> 
> 
> 
> 
>> On Oct 11, 2021, at 5:22 AM, Jean-Baptiste Onofre <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> Hi,
>> 
>> The broker is in slave mode when another process/broker has the lock on 
>> kahadb.
>> 
>> If you check in kahadb folder, you should have a lock file (in your case, it 
>> seems to be in /var/tmp/amq/data),  so, either you have already a broker 
>> running, either the broker doesn’t have to take/create the lock in the 
>> kahadb folder.
>> 
>> Regards
>> JB
>> 
>>> Le 9 oct. 2021 à 15:42, Dan Cosio <[email protected] 
>>> <mailto:[email protected]>> a écrit :
>>> 
>>> 
>>> Using ActiveMQ 5.16.2
>>> I'm seeing strange behavior when starting ActiveMQ using systemctl. The 
>>> server starts in slave mode:
>>> [pid: ][main] 08 Oct 2021 18:15:46  INFO XBeanBrokerFactory$1 - Refreshing 
>>> org.apache.activemq.xbean.XBeanBrokerFactory$1@68bbe345: startup date [Fri 
>>> Oct 08 18:15:46 UTC 2021]; root of context hierarchy
>>> [pid: ][main] 08 Oct 2021 18:15:46  INFO XBeanXmlBeanDefinitionReader - 
>>> Loading XML bean definitions from URL 
>>> [file:/var/tmp/amq/conf/activemq-nojournal-persistent-SSL.xml]
>>> [pid: ][main] 08 Oct 2021 18:15:46  INFO XBeanXmlBeanDefinitionReader - 
>>> Loading XML bean definitions from URL [file:/var/tmp/amq/conf/jetty.xml]
>>> [pid: ][main] 08 Oct 2021 18:15:47  INFO BrokerService - Using Persistence 
>>> Adapter: KahaDBPersistenceAdapter[/var/tmp/amq/data/kahadb]
>>> [pid: ][KahaDB Index Free Page Recovery] 08 Oct 2021 18:15:47  INFO 
>>> PageFile - Page File: /var/tmp/amq/data/kahadb/db.data. Recovering pageFile 
>>> free list due to prior unclean shutdown..
>>> [pid: ][KahaDB Index Free Page Recovery] 08 Oct 2021 18:15:47  INFO 
>>> PageFile - Page File: /var/tmp/amq/data/kahadb/db.data. Recovered pageFile 
>>> free list of size: 0
>>> [pid: ][main] 08 Oct 2021 18:15:47  INFO MessageDatabase - KahaDB is 
>>> version 7
>>> [pid: ][main] 08 Oct 2021 18:15:47  INFO PListStoreImpl - 
>>> PListStore:[/activemq-data/broker-persistent-SSL/tmp_storage] started
>>> [pid: ][main] 08 Oct 2021 18:15:47  INFO SharedFileLocker - Database 
>>> activemq-data/broker-persistent-SSL/scheduler/lock is locked by another 
>>> server. This broker is now in slave mode waiting a lock to be acquired
>>> 
>>> If I start the broker using sudo -u <user> it starts correctly.
>>> This is configured to run SSL with persistence:
>>>    <broker xmlns="http://activemq.apache.org/schema/core 
>>> <http://activemq.apache.org/schema/core>"
>>> 
>>> 
>>> useJmx="true"
>>> 
>>> 
>>> persistent="true"
>>> 
>>> 
>>> dedicatedTaskRunner="false"
>>> 
>>> 
>>> schedulerSupport="true"
>>> 
>>> 
>>> brokerName="broker-persistent-SSL">
>>> This is the process:
>>> /usr/bin/java -Dlog4j.dir=/var/tmp/amq/log 
>>> -Dlog_instance=ip-172-31-51-195.ec2.internal 
>>> -Dinvenio_log_component=mqbroker -Dcom.sun.management.jmxremote.port=51520 
>>> -Dcom.sun.management.jmxremote.ssl=false 
>>> -Dcom.sun.management.jmxremote.authenticate=false 
>>> -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote 
>>> -Djavax.net.ssl.keyStore=/var/tmp/amq/conf/broker.ks 
>>> -Djavax.net.ssl.keyStorePassword=<password> 
>>> -Djavax.net.ssl.trustStore=/var/tmp/amq/conf/broker.ts 
>>> -Djavax.net.ssl.trustStorePassword=<password> -Djava.awt.headless=true 
>>> -Djava.io.tmpdir=/var/tmp/amq/tmp 
>>> -Dactivemq.classpath=/var/tmp/amq/conf:/var/tmp/amq/../lib/: 
>>> -Dactivemq.home=/var/www/mqbroker/apache-activemq-5.16.2 
>>> -Dactivemq.base=/var/tmp/amq -Dactivemq.conf=/var/tmp/amq/conf 
>>> -Dactivemq.data=/var/tmp/amq/data -jar 
>>> /var/www/mqbroker/apache-activemq-5.16.2/bin/activemq.jar start 
>>> xbean:file:/var/tmp/amq/conf/activemq-nojournal-persistent-SSL.xml
>>> 
>>> I've removed the lock file and restarted. There are no other brokers on 
>>> this machine
>>> Can anyone give me a hint as to what may be causing this?
>>> 
>>> 
>>> Dan Cosio
>>> 
>>> <wired-logo.png> Wired Informatics
>>> 265 Franklin St Ste 1702
>>> Boston, MA 02110
>>> http://wiredinformatics.com <http://wiredinformatics.com/>
>>> [email protected] <mailto:[email protected]>
>>> 
>>> 
>>> 
>>> 
>> 
> 
> <wired-logo.png>

Reply via email to