Chapter 7. Starting a Broker

download PDF


You start a broker using a simple command. The broker can either be started so that it launches a command console or so that it runs as a daemon process. When a broker is part of a fabric, you can remotely start the broker remotely.


A broker can be run in one of two modes:
  • console mode—the broker starts up as a foreground process and presents the user with a command shell
  • daemon mode—the broker starts up as a background process that can be manged using a remote console or the provided command line tools
The default location for the broker's configuration for the broker is the InstallDir/etc/activemq.xml configuration file. The configuration uses values loaded from the InstallDir/etc/ file and the InstallDir/etc/ file.

Starting in console mode

When you start the broker in console mode you will be placed into a command shell that provides access to a number of commands for managing the broker and its OSGi runtime.
When the broker is started in console mode, you cannot close the console without killing the broker.
To launch a broker in console mode, change to InstallDir and run one of the commands in Table 7.1, “Start up Commands for Console Mode”.
Table 7.1. Start up Commands for Console Mode
If the server starts up correctly you should see something similar to Example 7.1, “Broker Console” on the console.

Example 7.1. Broker Console

      _ ____                                __  __  ____
     | |  _ \                    /\        |  \/  |/ __ \
     | | |_) | ___  ___ ___     /  \ ______| \  / | |  | |
 _   | |  _ < / _ \/ __/ __|   / /\ \______| |\/| | |  | |
| |__| | |_) | (_) \__ \__ \  / ____ \     | |  | | |__| |
 \____/|____/ \___/|___/___/ /_/    \_\    |_|  |_|\___\_\

  AMQ (6.3.0.redhat-187)

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.

Open a browser to http://localhost:8181 to access the management console

Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown AMQ.

Since version AMQ 6.2.1, launching in console mode creates two processes: the parent process ./bin/karaf, which is executing the Karaf console; and the child process, which is executing the Karaf server in a java JVM. The shutdown behaviour remains the same as before, however. That is, you can shut down the server from the console using either Ctrl-D or osgi:shutdown, which kills both processes.

Starting in daemon mode

Launching a broker in daemon mode runs Red Hat AMQ in the background without a console. To launch a broker in daemon mode, change to InstallDir and run one of the commands in Table 7.2, “Start up Commands for Daemon Mode”.
Table 7.2. Start up Commands for Daemon Mode

Starting a broker in a fabric

If a broker is deployed as part of a fabric you can start it remotely in one of three ways:
  • using the console of one of the other broker's in the fabric
    If one of the brokers in the fabric is running in console mode you an use the fabric:container-start command to start any of the other brokers in the fabric. The command requires that you supply the container name used when creating the broker in the fabric. For example to start a broker named fabric-broker3 you woul duse the command shown in Example 7.2, “Starting a Broker in a Fabric”.

    Example 7.2. Starting a Broker in a Fabric

    JBossA-MQ:karaf@root> fabric:container-start fabric-broker3
  • using the administration client of one of the broker's in the fabric
    If none of the brokers are running in console mode, you can use the administration client on one of the brokers to execute the fabric:container-start command. The administration client is run using the client command in Red Hat AMQ's bin folder. Example 7.3, “Starting a Broker in a Fabric with the Administration Client” shows how to use the remote client to start remote broker in the fabric.

    Example 7.3. Starting a Broker in a Fabric with the Administration Client

    bin/client fabric:container-start fabric-broker3
  • using the management console
    The management console can start and stop any of the brokers in the fabric it manages from a Web based console.
    For more information see Using the Management Console.
Red Hat logoGithubRedditYoutubeTwitter


Try, buy, & sell


About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.