...
-
start - starts the broker in background. It saves process id in the ${ACTIVEMQ_DATA_DIR}/activemq.pid for future reference. It accepts the same command line arguments like the original activemq script, so you can do something like
Codeblock |
$ bin/activemq start xbean:conf/activemq-stomp.xml |
-
console - starts the broker in foreground. It is basically the replacement for the old activemq script
(you can interrupt the )
...
-
create - create an ACTIVEMQ_BASE directory that separates a broker instance from its binaries, i.e., it creates copies of the ActiveMQ configuration files into the command-line specified directory and points to the binaries. You can start the broker with the /bin scripts in the newly created instance.
Codeblock |
$ bin/activemq create /path/to/brokers/mybroker |
-
browse - Display selected messages in a specified destination
Codeblock |
$ bin/activemq browse FOO.BAR # use broker connection from configuration
$ bin/activemq browse --amqurl tcp://localhost:61616 FOO.BAR |
-
bstat - Performs a predefined query that displays useful statistics regarding the specified broker
-
dstat - Performs a predefined query that displays useful tabular statistics regarding the specified destination type
-
decrypt - Decrypts given text
Codeblock |
$ bin/activemq decrypt --input 'BkiT42A0CZfL1SanJIgxvQ==' --password asdasdasdasd |
-
encrypt - Encrypts given text
Codeblock |
$ bin/activemq encrypt --password TESTPASSWORD --input FOOBAR |
-
export - Exports a stopped brokers data files to an archive file
-
list - Lists all available brokers in the specified JMX context
-
purge - Delete selected destination's messages that matches the message selector
Codeblock |
$ bin/activemq purge FOO.BAR # use jmx access data from configuration
$ bin/activemq purge --jmxurl service:jmx:rmi:///jndi/rmi://127.0.0.1:11098/jmxrmi --jmxuser controlRole --jmxpassword abcd1234 FOO.BAR |
-
query - Display selected broker component's attributes and statistics
Codeblock |
$ bin/activemq query # use jmx access data from configuration
$ bin/activemq query --jmxurl service:jmx:rmi:///jndi/rmi://127.0.0.1:11098/jmxrmi --jmxuser controlRole --jmxpassword abcd1234 |
Daemon Installation / Script Installation
-
Install activemq broker as "root" to be run as "activemq"
Codeblock |
$ useradd -m activemq -d /srv/activemq
$ cd /srv/activemq
$ tar zxvf apache-activemq-<version>-bin.tar.gz$ ln -snf apache-activemq-<version> current
$ chown -R activemq:users apache-activemq-<version>
|
-
Create a global default configuration and edit the configuration
Codeblock |
$ cp apache-activemq-<version>/bin/env /etc/default/activemq
$ vim /etc/default/activemq
|
-
Install the init script
Codeblock |
ln -snf /srv/activemq/current/bin/activemq /etc/init.d/activemq
|
-
Activate the init script at system startup
(TODO: uncomplete)
Codeblock |
# RHEL
chkconfig --add activemq
chkconfig activemq on
# Debian/Ubuntu
update-rc.d defaults activemq
|
Configuring the script
Configuring the init-script
For ActiveMQ server to run properly some basic system variables must be set. These variables define how much memory broker will have, SSL, logging, JAAS options and similar.
Version 5.11.0 and higher
Configuration file of the init-script
Since version 5.11.0, all default configuration variables are moved to the new env script file, so that they can be easily configured at one place.inspected and configured in a easy way.
There are also other configuration locations
The script scans the following locations for configurations in the following order:
...
The first existing file is read exclusively - all other files are irgnoredignored.
Undefined values are discovered in a automated way.
Running multiple instances
To use addtional configurations for running multiple instances on the same operating system rename or symlink script to a name matching to activemq-instance-<INSTANCENAME>.
This changes the configuration location to /etc/default/activemq-instance-<INSTANCENAME> and $HOME/.activemqrc-instance-<INSTANCENAME>. Configuration files in /etc have higher precedence.
...
To use addtional configurations for running multiple instances on the same operating system rename or symlink script to a name matching to activemq-instance-<INSTANCENAME>. This changes the configuration location to /etc/default/activemq-instance-<INSTANCENAME> and $HOME/.activemqrc-instance-<INSTANCENAME>. Configuration files in /etc have higher precedence.
Running activemq as a unix daemon
-
Install activemq broker as "root" to be run as "activemq"
Codeblock |
useradd -m activemq -d /srv/activemq
cd /srv/activemq
tar zxvf apache-activemq-<version>-bin.tar.gz$ ln -snf apache-activemq-<version> current
chown -R activemq:users apache-activemq-<version>
|
-
Create a global default configuration and edit the configuration
Codeblock |
cp apache-activemq-<version>/bin/env /etc/default/activemq
sed -i '~s/^ACTIVEMQ_USER=""/ACTIVEMQ_USER="activemq"/' /etc/default/activemq
vim /etc/default/activemq
chmod 644 /etc/default/activemq
|
- Configure the java heap to a size suitable to your system environment and usage
- Consider to move the folders "data", "tmp" and "conf" out of the installation path
-
Install the init script
Codeblock |
ln -snf /srv/activemq/current/bin/activemq /etc/init.d/activemq
|
-
Activate the init script at system startup
(TODO: uncomplete)
Codeblock |
# RHEL
chkconfig --add activemq
chkconfig activemq on
# Debian/Ubuntu
update-rc.d defaults activemq
|