Default Configuration
Variable |
Default |
Description |
---|---|---|
x.y.z |
5.5.0 |
Current stable ActiveMQ version |
ACTIVEMQ_HOME |
/usr/local/apache-activemq-x.y.z |
Installation directory |
INSTANCE_NAME |
broker |
Name of broker - should maybe correlate with host name? |
Installing ActiveMQ
- Download the latest stable ActiveMQ release (
apache-activemq-x.y.z.tar.gz
). - Move to the installation root
cd /usr/local
. - Unpack the release
tar xzvf /path/to/apache-activemq-x.y.z.tar.gz
- Create ActiveMQ user account
useradd activemq
- Optional: Edit the global configuration files
vim /usr/local/apache-activemq-x.y.z/conf/{activemq,jetty}.xml
before setting up instances. - Optional: Setup service script
Configuring instances
For each broker instance:
- Switch to activemq account
su - activemq
- If needed, create an instance wide setup file
/usr/local/apache-activemq-x.y.z/bin/activemq setup ~activemq/.activemqrc
. (ActiveMQ doesn't seem to use per instance rc files any more?) - Create broker instance configuration
/usr/local/apache-activemq-x.y.z/bin/activemq create $(INSTANCE_NAME)
- Configure broker
vim $(INSTANCE_NAME)/conf/{activemq,jetty}.xml
- Optional: Set up key and trust stores in
$(INSTANCE_NAME)/conf/broker.{k,t}s
- Optional: Add broker to the service script, so that the broker may be automatically started on reboot.
Service/Init Script
For now see here
Later, something like this should work:
chmod +x /etc/init.d/activemq
chkconfig --add activemq
chkconfig activemq on
/etc/init.d/activemq start
# activemq-start.sh #!/bin/bash echo Starting ActiveMQ.... sh /home/activemq/test-broker-1/bin/test-broker-1 start sh /home/activemq/test-broker-2/bin/test-broker-2 start # activemq-stop.sh #!/bin/bash echo Stopping ActiveMQ.... sh /home/activemq/test-broker-1/bin/test-broker-1 stop sh /home/activemq/test-broker-2/bin/test-broker-2 stop # activemq #!/bin/bash # # activemq Starts ActiveMQ. # # chkconfig: 345 88 12 # description: ActiveMQ is a JMS Messaging Queue Server. ### BEGIN INIT INFO # Provides: $activemq ### END INIT INFO # Source function library. . /etc/init.d/functions [ -f /home/activemq/activemq-start.sh ] || exit 0 [ -f /home/activemq/activemq-stop.sh ] || exit 0 RETVAL=0 umask 077 start() { echo -n $"Starting ActiveMQ: " daemon su -c /home/activemq/activemq-start.sh activemq echo return $RETVAL } stop() { echo -n $"Shutting down ActiveMQ: " daemon su -c /home/activemq/activemq-stop.sh activemq echo return $RETVAL } restart() { stop start } case "$1" in start) start ;; stop) stop ;; restart|reload) restart ;; *) echo $"Usage: $0 {start|stop|restart}" exit 1 esac exit $?