LATEST VERSION: 8.2.8 - CHANGELOG
Pivotal GemFire® v8.2

Basic Shell Features and Command-Line Usage

Basic Shell Features and Command-Line Usage

The gfsh utility provides useful features for a shell environment, including command auto-complete, preserved command history, and delimiting of multi-line commands. Context-sensitive help is available by command and by topic.

This section describes these features.

To view a list of available gfsh commands, press Tab at an empty prompt.

The list of commands you see depends on whether you are connected to a GemFire distributed system. If you are not connected, you see a list of local commands that are available.
gfsh>

alter disk-store              compact offline-disk-store
connect                       debug
describe connection           describe offline-disk-store
disconnect                    echo
encrypt password              exit
help                          hint
history                       run
set variable                  sh
sleep                         start jconsole	     	  
start jvisualvm               start locator
start pulse                   start server
start vsd                     status locator
status server                 stop locator
stop server                   upgrade offline-disk-store
validate offline-disk-store   version

Use the hint command to get information on a particular topic.

The hint command displays a one-line description and associated commands for a specified topic. For example, typing hint data returns a description of the "data" topic and all the possible actions available for data:
gfsh>hint data
User data as stored in regions of the GemFire distributed system.

create index  : Create an index that can be used when executing queries.
destroy index : Destroy/Remove the specified index.
export data   : Export user data from a region to a file.
get           : Display an entry in a region. If using a region whose key and value classes have been set, then specifying --key-class and --value-class is unnecessary.
import data   : Import user data from a file to a region.
list indexes  : Display the list of indexes created for all members.
locate entry  : Identifies the location, including host, member and region, of entries that have the specified key.
put           : Add/Update an entry in a region. If using a region whose key and value classes have been set, then specifying --key-class and --value-class is unnecessary.
query         : Run the specified OQL query as a single quoted string and display the results in one or more pages. Limit will default to the value stored in the "APP_FETCH_SIZE" variable. Page size will default to the value stored in the "APP_COLLECTION_LIMIT" variable.
rebalance     : Rebalance partitioned regions. The default is for all partitioned regions to be rebalanced.
remove        : Remove an entry from a region. If using a region whose key class has been set, then specifying --key-class is unnecessary.
Type hint server to view a description of servers in GemFire and a list of commands available for managing and monitoring them.
gfsh>hint server
A server is GemFire cluster member which holds a GemFire cache. Depending on the topology used it can refer to either a system that responds to client requests or a system that is only a peer to other members.

describe member : Display information about a member, including name, id, groups, regions, etc.
export logs     : Export the log files for a member or members.
list members    : Display all or a subset of members.
start server    : Start a GemFire Cache Server.
status server   : Display the status of a GemFire Cache Server.
stop server     : Stop a GemFire Cache Server.
To view a list of hint topics, type hint.
gfsh>hint
Hints are availbale for following topics. Use "hint <topic-name>" for a specific hint.
Configuration
Data
Debug-Utility
Disk Store
Function Execution
GFSH
GemFire
Help
JMX
Lifecycle
Locator
Management-Monitoring
Manager
Region
Server
Statistics

Use the help command to get information on a particular command.

Depending on the command, typing help <command-name> displays usage information for that particular command or a list of commands related to the command.

For example, type help start to display a list of start commands with short descriptions. The descriptions indicate whether the command is available, depending on your connection status. In the following example, you are not currently connected to a GemFire distributed system (via connection to a JMX Manager node), so some start commands are unavailable.
gfsh>help start
start jconsole (Available)
    Start the JDK's JConsole tool in a separate process. JConsole will be
    launched, but connecting to GemFire must be done manually.
start jvisualvm (Available)
    Start the JDK's Java VisualVM (jvisualvm) tool in a separate process. Java
    VisualVM will be launched, but connecting to GemFire must be done manually.
start locator (Available)
    Start a Locator.
start pulse (Available)
    Open a new window in the default Web browser with the URL for the Pulse
    application.
start server (Available)
    Start a GemFire Cache Server.
In the following example, typing help export data displays the command name, availability (depending on your connection status), a description, its syntax, and a list of all its required and optional parameters.
gfsh>help export data
NAME
        export data
IS AVAILABLE
        false
SYNOPSIS
        Export user data from a region to a file.
SYNTAX
        export data --region=value --file=value --member=value
PARAMETERS
        region
                Region from which data will be exported.
                Required:true
        file
                File to which the exported data will be written.
The file must have an extension of ".gfd".
                Required:true
        member
                Name/Id of a member which hosts the region. 
The data will be exported to the specified file on the host 
where the member is running.
                Required:true

Use the Tab key to auto-complete a command or trigger possible completions.

Use the Tab key after entering a partial command to trigger auto-completion of the command or a list of possible command completions. For example, hitting Tab after typing hint displays all available topics:
gfsh>hint 

Configuration           Data                    Debug-Utility           
Disk Store              Function Execution      GFSH                    
GemFire                 Help                    JMX                     
Lifecycle               Locator                 Management-Monitoring   
Manager                 Region                  Server                  
Statistics                           
Hitting tab after typing hint d displays the topics available that begin with 'd':
gfsh>hint d

data            debug-Utility   disk Store
Auto-completion also supplies available parameters and arguments to commands; for example, hitting tab after typing start will list all the processes that can be started.
gfsh>start

start data-browser   start jconsole       start jvisualvm
start locator        start pulse          start server
Hitting tab after start locator will populate the required --name parameter after the command.
Note: The available commands that are listed varies depending on whether you are currently connected to a distributed system.

To use auto-completion from a UNIX bash shell, see Tab Completion.

Access command history with the Up arrow.

Access a command in your shell history by scrolling through previous commands with the Up arrow.

Delimit multi-line commands with \.

When entering long commands, you can break the command line up by using the \ character as a delimiter. For example:
gfsh>create region --name=region1 \
--type=REPLICATE_PERSISTENT \
--cache-writer=com.gemstone.gemfire.examples.MyCacheWriter \
--group=Group1 --disk-store=DiskStore1

Enclose strings that contain spaces or commas with single or double quotes

When you execute gfsh commands in the gfsh command shell, enclose any strings that contain spaces or commas in single quotes. For example:
gfsh>start locator --name='locator 1'
start locator --name=locator1 --port=9009 --mcast-port=0\
 --J='-Dgemfire.remote-locators=10.117.33.214[9009],10.117.33.220[9009]'
When you execute multiple gfsh commands in a single line from the operating system shell, enclose the gfsh commands in double quotes. Within the double quotes, enclose any strings that contain spaces or commas with single quotes. For example:
$ gfsh -e "start locator --name='locator 1'" -e "start server --name=server1"