简体   繁体   中英

ActiveMQ data and conf folder needs to be changed to different file system in Linux

I have downloaded and setup ActiveMQ 5.15.0 in my machine and followed this guide.

In conf folder I see in conf/log4j.properties there is a line with the path for Log Location.

log4j.appender.logfile.file=${activemq.data}/activemq.log 

How this variable ${activemq.data} is configured and how to change it?

The value for ${activemq.data} is read from the environment variable $ACTIVEMQ_DATA by the activemq script when starting the broker. For example, when you start the broker using the default configuration you'll see this logged:

$ ./activemq console
...
ACTIVEMQ_HOME: /home/jbertram/java/apache-activemq-5.15.8
ACTIVEMQ_BASE: /home/jbertram/java/apache-activemq-5.15.8
ACTIVEMQ_CONF: /home/jbertram/java/apache-activemq-5.15.8/conf
ACTIVEMQ_DATA: /home/jbertram/java/apache-activemq-5.15.8/data
Loading message broker from: xbean:activemq.xml
...

However, if you set the $ACTIVEMQ_DATA variable to something else, eg:

$ export ACTIVEMQ_DATA=/tmp

Then this will be logged:

$ ./activemq console
...
ACTIVEMQ_HOME: /home/jbertram/java/apache-activemq-5.15.8
ACTIVEMQ_BASE: /home/jbertram/java/apache-activemq-5.15.8
ACTIVEMQ_CONF: /home/jbertram/java/apache-activemq-5.15.8/conf
ACTIVEMQ_DATA: /tmp
Loading message broker from: xbean:activemq.xml
...

You can also change this using the bin/env file. This is what the default env contains:

...
# Active MQ installation dirs
# ACTIVEMQ_HOME="<Installationdir>/"
# ACTIVEMQ_BASE="$ACTIVEMQ_HOME"
# ACTIVEMQ_CONF="$ACTIVEMQ_BASE/conf"
# ACTIVEMQ_DATA="$ACTIVEMQ_BASE/data"
# ACTIVEMQ_TMP="$ACTIVEMQ_BASE/tmp"
...

You could change this to be something like this:

...
# Active MQ installation dirs
# ACTIVEMQ_HOME="<Installationdir>/"
# ACTIVEMQ_BASE="$ACTIVEMQ_HOME"
# ACTIVEMQ_CONF="$ACTIVEMQ_BASE/conf"
ACTIVEMQ_DATA="/tmp"
# ACTIVEMQ_TMP="$ACTIVEMQ_BASE/tmp"
...

It's worth noting that ActiveMQ "Classic" 5.15.0 was released in June of 2017 (ie over 5 years ago now). I strongly recommend you upgrade to a more recent release, ideally the latest .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM