Search

11.2. Shutting Down a Broker Remotely

download PDF

Abstract

You have a number of options for stopping a broker running on a remote machine. You can stop the broker using a console or without using a console. You can also step a broker remotely using the management console.

Overview

For many use cases logging into the machine running a broker instance is impractical. In those cases, you need a way to stop a broker from a remote machine. Red Hat JBoss A-MQ offers a number of ways to accomplish this task:
  • using the stop command—the stop command does not require starting an instance of the broker
  • using a remote console connection—a broker's console can be used to remotely shutdown a broker on another machine
  • using a fabric member's console—brokers that are part of a fabric can stop members of their fabric
  • using the management console—brokers that are part of a fabric can be stopped using a management console connected to their fabric
    For more information see Using the Management Console.

Using the stop command

You can stop a remote instance without starting up Red Hat JBoss A-MQ on your local host by running the stop command in the InstallDir/bin directory. The commands syntax is shown in Example 11.2, “Stop Command Syntax”.

Example 11.2. Stop Command Syntax

stop [ -a port ] { -h hostname } { -u username } { -p password }

-a port
Specifies the SSH port of the remote instance. The default is 8101.
-h hostname
Specifies the hostname of the machine on which the remote instance is running.
-u username
Specifies the username used to connect to the remote broker.
Note
The default username for a broker is karaf.
-p password
Specifies the password used to connect to the remote broker.
Note
The default password for a broker is karaf.
Example 11.3, “Stopping a Remote Broker” shows how to stop a remote broker on a machine named NEBrokerHost2.

Example 11.3. Stopping a Remote Broker

bin/stop -u karaf -p karaf -h NEBrokerHost2

Using a remote console

Red Hat JBoss A-MQ's console can be connected to a remote broker using the ssh:ssh command. The SSH port 8101 is used to access the desired remote console. Once the console is connected to the remote broker, you can shut it down by running the osgi:shutdown command. Example 11.4, “Shutting Down a Broker using a Remote Console Connection” shows the command sequence for using a remote console connection to shutdown a broker running on a machine named NWBrokerHost.

Example 11.4. Shutting Down a Broker using a Remote Console Connection

JBossA-MQ:karaf@root> ssh -l username -P password 8101 HOSTNAME
       _ ____ __ __ ____ | | _ \ /\ | \/ |/ __ \ | | |_) | ___ ___ ___ / \ ______| \ / | | | | _ | | _ < / _ \/ __/ __| / /\ \______| |\/| | | | | | |__| | |_) | (_) \__ \__ \ / ____ \ | | | | |__| | \____/|____/ \___/|___/___/ /_/ \_\ |_| |_|\___\_\ JBoss A-MQ (6.0.0.redhat-012) http://www.redhat.com/products/jbossenterprisemiddleware/amq/ Hit '<tab>' for a list of available commands and '[cmd] --help' for help on a specific command. Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown JBoss A-MQ. 

JBossA-MQ:karaf@root> osgi:shutdown 
Confirm: shutdown instance root (yes/no):
yes
JBossA-MQ:karaf@root> JBossA-MQ:karaf@root>
Important
Pressing Control+D when connected to a remote broker closes the remote connection and returns you to the local shell.

Shutting down remote brokers in a fabric

If the broker you want to shutdown is part of a fabric, you can shut it down from any of the brokers in the fabric using the fabric:container-stop console command. fabric:container-stop takes the name of the fabric container hosting the broker as an argument. The command can be run either from a broker in console mode or using the broker's administration client.
Example 11.5, “Shutting Down a Broker in a Fabric” shows how to use the administration client to shutdown a broker running in a container named fabric-broker3.

Example 11.5. Shutting Down a Broker in a Fabric

./bin/client fabric-broker3 fabric:container-stop
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

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.