Chapter 1. Using the Command Console
Overview
The Red Hat JBoss Fuse command console is the central tool for both managing the JBoss Fuse environment and interacting with Fuse Fabric. When you start JBoss Fuse the console starts automatically.
The console provides commands that you can use to perform basic management of your JBoss Fuse environment, including deploying and configuring applications.
The console uses prefixes to group commands relating to the same functionality. For example, commands related to configuration are prefixed config:, and logging-related commands are prefixed log:.
Starting the command console
To start JBoss Fuse open a command prompt in the installation directory and enter:
Windows | bin\fuse |
*NIX | bin/fuse |
JBoss Fuse starts and the console is ready. You should see a prompt similar to this:
_ ____ ______ | | _ \ | ____| | | |_) | ___ ___ ___ | |__ _ _ ___ ___ _ | | _ < / _ \/ __/ __| | __| | | / __|/ _ \ | |__| | |_) | (_) \__ \__ \ | | | |_| \__ \ __/ \____/|____/ \___/|___/___/ |_| \__,_|___/\___| JBoss Fuse (6.0.0.redhat-xxx) http://www.redhat.com/products/jbossenterprisemiddleware/fuse/ 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 Fuse. JBossFuse:karaf@root
Getting help
The console provides two levels of help:
- console help—lists all of the commands along with a brief summary of the commands function
- command help—provides a detailed description of a command and its arguments
To access the console help, enter the help command from the console prompt. It displays a grouped list of all the commands available in the console. Each command in the list is followed by a description, as shown in Example 1.1, “Console Help”.
Example 1.1. Console Help
JBossFuse:karaf@root>
help
COMMANDS activemq:browse activemq:bstat activemq:create-broker Creates a broker instance. activemq:destroy-broker Destory a broker instance. activemq:list activemq:purge activemq:query admin:change-opts Changes the Java options of an existing container instance. admin:change-rmi-registry-port Changes the RMI registry port (used by management layer) of an existing container instance.
...JBossFuse:karaf@root>
The help for each command includes the definition, the syntax, and the arguments and any options. To display the help for a command, type the command with the
--help
option. As shown in Example 1.2, “Help for a Command”, entering admin:start --help
displays the help for that command.
Example 1.2. Help for a Command
JBossFuse:karaf@root>
admin:start --help
DESCRIPTION admin:start Starts an existing container instance. SYNTAX admin:start [options] name ARGUMENTS name The name of the container instance OPTIONS --help Display this help message -o, --java-opts Java options when launching the instance
JBossFuse:karaf@root>
Command completion
Pressing Tab at anytime provides you with a list of commands that can complete what you have already entered at the prompt. For example, if you enter
active
followed by Tab, a list similar to Example 1.3, “Console Commands” is shown.
Example 1.3. Console Commands
activemq:browse activemq:bstat activemq:create-broker activemq:destroy-broker activemq:list activemq:purge activemq:query JBossA-MQ:karaf@root>
If you press Tab without entering anything at the prompt, the console lists all of the available commands.
Command groups
Commands are grouped under prefixes according to functionality. Table 1.1, “Apache ActiveMQ Command Groups” summarizes the command groups available in the console. Click on a command group name for more information.
Command Group | Description |
---|---|
activemq | Views and manages brokers and messages. |
admin | Creates, manages, and destroys containers. |
camel | Manages Apache Camel contexts and routes |
config | Manages configuration. |
cxf | Manages Apache CXF buses and endpoints. |
dev | Utilities that are useful for a developer while testing bundles in the container. |
fab | Manages the dependency resolution mechanism used by Fuse Application Bundles. |
fabric | Performs provisioning and configuration using Fuse Fabric. |
features | Performs provisioning based on Apache Karaf feature specs. |
jaas | Manages the console's security settings. |
jbi | Manage deployed JBI artifacts. |
log | Displays and configures logging. |
nmr | Lists NMR endpoints. |
obr | Accesses the OSGi Bundle Repository (OBR). |
osgi | Manages OSGi bundles. |
packages | Lists imported and exported packages. |
patch | Manages patches. |
shell | Performs basic console functions |
ssh | Creates and connects to a remote SSH server |
web | Lists the WARs deployed in the container. |
zk | Accesses and modifies entries in the Zookeeper registry. |
Short version
Many of the console commands allow you to omit the group prefix.
If the command is only in one command groups, you can omit the group prefix. For example, you can enter bstat in place of activemq:bstat because it only exists in the activemq command group.
If the command exists in multiple command groups, you can still drop the prefix and the console will default to using the version of the command from one of the following command groups:
- shell
- osgi
- admin
For example, info is equivalent to shell:info. If you wanted to use osgi:info, you need to enter the full command.
About console input
In console input, the Karaf shell drops leading zeros when the input appears to be a number. For example:
FuseMQ:karaf@root>
echo 0123 123FuseMQ:karaf@root>
echo 00.123 0.123FuseMQ:karaf@root>
This is a problem if you define a numeric username with a leading zero. The shell drops the leading zero and login attempts fail. To avoid this, do not use a zero as the first character in a numeric username. Alternatively, include at least one alphabetic character in a username.