This topic explains how to configure the VMware Tanzu GemFire command-line interface (gfsh
) environment.
You can set user-configurable properties for security, environment variables, logging, and troubleshooting.
Since gfsh
must connect to a JMX Manager member to run certain commands (namely those commands that manage and monitor other members), JMX Manager configuration properties can affect gfsh
security. In gemfire.properties
, the following GemFire properties can affect gfsh
connection settings to the JMX Manager:
jmx-manager-ssl
jmx-manager-port
jmx-manager-password-file
jmx-manager-access-file
You may also need to verify that the ports are available and open to client connections. See Configuring a JMX Manager for details on these security properties.
In addition, you can set gfsh-specific preset SHELL variables by using the set variable
command. For example, you can set gfsh
to run in quiet mode. Not all gfsh
variables are modifiable. User-configurable variables include:
See Useful gfsh Shell Variables for more information.
By default, gfsh
session logging is deactivated. To enable gfsh
logging, you must set the Java system property -Dgfsh.log-level=desired_log_level
where desired_log_level is one of the following values: severe, warning, info, config, fine, finer, finest. For example, in Linux:
export JAVA_ARGS=-Dgfsh.log-level=info
Then, start gfsh
.
gfsh
produces a log file named gfsh-%u_%g.log. This log file records the events of an individual gfsh
session. It includes environment information, such as Java and system information, and detailed command execution. The variables are replaced as follows:
gfsh
uses the JDK Logger to generate gfsh session log files. For a description of how the variables are used in naming the log file, see Class FileHandle on the Oracle documentation website. The default name of the generated gfsh
log file cannot be changed.
By default, the log file is written to the current working directory where you have executed the gfsh
or gfsh.bat
script. To modify the directory location where log files are written, use the gfsh.log-dir
Java system property. For example:
export JAVA_ARGS="-Dgfsh.log-level=info -Dgfsh.log-dir=/machinename/logs"
Then, start gfsh
.
In addition, gfsh
records a history of commands in the ${SYS_USER_HOME}/.geode/.gfsh.history
file, which you can use to create scripts or review past commands.
gfsh writes several log files for any members that are started via gfsh. Useful member log files include:
locator1.log
in the <product_dir>/locator1
directory.server1.log
in the <product_dir>/server1
directory. If you stop and start the server with an identical name, the older log files are kept in the same directory but renamed for versioning purposes.By default, GemFire does not show messages written by the application to standard output and standard error. To allow these messages to be written to the locator and server log files, respectively, specify the --redirect-output
option with the gfsh start locator
or start server
commands. For example, the following command causes stdout
and stderr
messages to be written to the locator1.log
file:
gfsh> start locator --name=locator1 --redirect-output
This section applies only to UNIX installations.
When you run gfsh commands from a UNIX bash shell, you can enable automatic tab-completion in the shell by running the following command:
source <gemfire-install-directory>/bin/gfsh-completion.bash
After running this command, you can use auto completion when running gfsh commands from the bash shell.
See Using Tab Completion.
A history of commands that have been executed successfully is logged in .gfsh.history
file in a .gemfire
directory under the home directory of the user running gfsh. You can also export a history file by using the history --file=your_file_name
command.
When you perform data operations (such as put) and then monitor the state of the system (such as using the gfsh show metrics
command or GemFire Pulse), the monitored system may not immediately reflect the most recent operations. For example, if you perform a put operation and then immediately execute the show metrics
gfsh command, you may not see the correct number of entries in the region. The management layer updates every 2 seconds. Wait a few seconds after performing operational activity to see the most accurate results.
You can modify the jmx-manager-update-rate
property in gemfire.properties
to increase or decrease the rate (specified in milliseconds) at which updates are pushed to the JMX Manager. This property setting should be greater than or equal to the statistic-sample-rate
. You may want to increase this rate if you are experiencing performance issues; however, setting this value too high will cause stale values to be seen in gfsh
and GemFire Pulse.
This section applies only to UNIX installations.
gfsh commands such as query
produce output with wide columns that may become misaligned and require manual reformatting to view the output. If the output cannot fit in the available width of the terminal, gfsh automatically trims the columns widths to fit. You can deactivate this behavior by setting the gfsh environment variable APP_RESULT_VIEWER
to an arbitrary value that is not external
or basic
.
You can set the APP_RESULT_VIEWER
variable to external
to enable viewing of the output using the UNIX less
command.