Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Download the latest stable ActiveMQ release (apache-activemq-x.y.z.tar.gz).
  2. Move to the installation root cd /usr/local.
  3. Unpack the release tar xzvf /path/to/apache-activemq-x.y.z.tar.gz
  4. Create ActiveMQ user account useradd activemq
  5. Optional: Edit the global configuration files vim /usr/local/apache-activemq-x.y.z/conf/{activemq,jetty}.xml before setting up instances.
  6. Optional: Setup service script
Configuring instances

For each broker instance:

  1. Switch to activemq account su - activemq
  2. If needed, create an instance wide setup file
  3. Set up key and trust stores in /usr/local/apache-activemq-x.y.z/bin/activemq setup ~activemq/.activemqrc. To use per instance activemqrc files (named ~/.activemqrc-instance-$(INSTANCE_NAME)) the start script used to start the instance must start with *activemq-instance-$(INSTANCE_NAME).
  4. Create broker instance configuration /usr/local/apache-activemq-x.y.z/bin/activemq create $(INSTANCE_NAME)
  5. Configure broker vim $(INSTANCE_NAME)/conf/{activemq,jetty}.xml
  6. Optional: Set up key and trust stores in $(INSTANCE_NAME)/conf/broker.{k,t}s
  7. Optional: Add broker to the service script, so that the broker may be automatically started on reboot.Setup service script
Service/Init Script

Anchor
servicescript
servicescript

...

No Format
# activemq-start.sh
#!/bin/bash
echo Starting ActiveMQ....
sh /homeusr/activemqlocal/testapache-broker-1/bin/test-broker-1 start
sh /home/activemq/test-broker-2/bin/test-broker-2activemq-x.y.z/bin/activemq start

# activemq-stop.sh
#!/bin/bash
echo Stopping ActiveMQ....
sh /homeusr/activemqlocal/testapache-broker-1activemq-x.y.z/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 $?