Command Line Interface
GigaSpaces provides a Command Line Interface (CLI) tool for administering both XAP and InsightEdge. The CLI is based on the REST Manager API, enabling users to administer local, remote, and cloud-based application environments. In addition to the REST Manager API operations, the CLI supports certain administration tasks in the open source application editions.
Users that are administering a XAP environment should use the
xap script. Users that are administering InsightEdge should use the
insightedge CLI script, which contains all of the actions available with the
xap script, plus additional options where relevant for administering InsightEdge components.
The image below shows the screen that is displayed when you run the
--help command (or
-h) to see the syntax of a specified CLI command, or a list of all available commands. The list of commands may vary depending on whether you are running the XAP or the InsightEdge script. For example,
the list of commands for
insightedge host run-agent --help contains all the actions available under
xap host run-agent --help, plus additional options for administering the Spark master and worker components.
The CLI connects to the REST Manager API using the name or IP address of the Manager server. Configuration is applied from one of the following:
- The first server configured in the
- The server configured using
--servercommand line option.
localhostas the server to connect to (if none of the above was applied).
Bash completion in the CLI is available for Linux and MacOS X users. After activating the autocomplete feature (as explained below), navigate to
<XAP-HOME>/bin and type
xap [TAB][TAB] or
insightedge [TAB][TAB]. This will complete the command sequence, or list all the available completions if there are multiple options.
MacOS X Users Only
If you are using the CLI in a MacOS X environment, the autocomplete script will only work if bash version 4 is installed on your machine. After installing the required bash version, add the shell to the allowed shells and make it the default shell.
When using autocomplete, type
./xap [TAB][TAB] or
You can add xap as an alias to the
.bash_profile, in order to simplify using autocomplete.
Activating the Autocomplete Feature
The autocomplete script is located in
<XAP-HOME>/tools/cli. There are two ways to install autocomplete.
Method 1 - Install Only for the Current Bash Console
- Go to
<XAP-HOME>/tools/cliand source the completion script:
- Go to
When you leave the bash session, autocomplete stops working.
Method 2 - Permanent Installation
- Place the
insightedge-autocompletefile in a
bash_completion.dfolder. The folder may appear in the following locations:
~/bash_completion.d(create one if absent).
- (MacOS X users only) Edit the
~/.bash_profileand add the following code:
- (MacOS X users only) Reload the bash shell or open a new terminal
- After installing the script, open a new bash console.
- Go to
- If you export the xap or insightedge classpath, autocomplete will work from any directory. If you don’t export the classpath, autocomplete works only from the bin directory.
- You can add a bash alias, for example:
alias xap = "cd <XAP-HOME>/bin && xap"
Customizing the Autocomplete Feature
If you want to generate a new autocomplete script (for example, if you changed the name of the xap or insightedge script) do so as follows:
<XAP-HOME>/tools/cli and run the following command:
java -cp "../../lib/required/*:*" MAIN_COMMAND ALIAS
MAIN_COMMAND value is different for each product and edition. Use one of the following:
- XAP open source -
- XAP Enterprise -
- Insightedge open source -
- Insightedge Enterprise -
ALIAS is optional; use it if you changed the name of the command.
java -cp "../../lib/required/*:*" MAIN_COMMAND ALIAS, the autocomplete script will appear in
Running a Local Manager Server
To run a local Manager server and a web browser client, type
xap host run-agent --auto or
insightedge host run-agent --auto.
To view a list of the running agents, type
xap host list or
insightedge host list.