Scripting Common Operations
Gfsh commands may be placed into files, providing a way to script common maintenance operations. Scripting operations reduces errors that might occur when manually entering commands, and can be especially useful for running test cases and in deployment automation.
gfsh run command invokes the gfsh commands that are
in a file.
Start up the gfsh command line interface first,
and then invoke the command with:
To see the
gfsh run options, invoke:
File specification can be a relative or absolute path and file name. Scripted commands are not interactive; any command that would have prompted for input will instead use default values.
In order to eliminate placing cleartext passwords within a script,
run gfsh and connect to the cluster prior to running a script with
The password will appear on the command line,
but it will not appear in the file that logs and captures gfsh commands.
Tightly focussed scripts will ease cluster maintenance. Most of these scripts will do cluster management operations, so connect to the cluster with a role that is able to manage both the cluster and the data.
A common operation will be creating the regions hosted on the servers. This example gfsh script contents creates two regions:
create region --name=sessions --type=PARTITION_REDUNDANT create region --name=customers --type=REPLICATE
This example gfsh script contents deploys a app JAR file to the cluster servers:
This example gfsh script contents creates the disk store needed for persistent regions:
create disk-store --name=all-regions-disk --dir=regions