Geode also open sourced a GO client that would interact with any running cluster's management REST service. Each REST end point would corresponds to a "command" in this tool. Executing a command in this CLI would invoke the corresponding REST end point. The features of this GO client are:
- It's cluster version independent. The client can talk to any version of the Geode cluster.
- The result is a json string by default. Adding "-t" with an optional JQ selector to the option list would show the result in tabular format
Where to Download this CLI Client
The Tanzu Gemfire Go Client source code and executables are available here: https://github.com/gemfire/tanzu-gemfire-management-cf-plugin
How to use the CLI Client
After download the latest version to any folder of your choice, all you need is a running cluster which has the cluster management service running:
The first you want to check out is the "-h" option:
$ ./gemfire -h Commands to interact with a Geode cluster. Usage: gemfire <target> <command> [options] target: URL to a Geode locator in the form of: http(s)://host:port Optional if 'GEODE_TARGET' environment variable is set command: 'gemfire <target> commands' lists available commands options: 'gemfire <target> <command> -h' lists options for an individual command --user, -u <username>, or a 'GEODE_USERNAME' environment variable sets the username --password, -p <password>, or a 'GEODE_PASSWORD' environment variable sets the password --table, -t [<jqFilter>] outputs in a tabular form help: --help, -h for general help, and provide <target> and <command> for command-specific help
To see a list of commands available to the target cluster
$ ./gemfire http://localhost:7070 commands check rebalance --id <id> configure pdx --pdxType <json or @json_file_path> create gateway-receiver --gatewayReceiverConfig <json or @json_file_path> create index --indexConfig <json or @json_file_path> create region --regionConfig <json or @json_file_path> create region index --indexConfig <json or @json_file_path> --regionName <regionName> delete region --id <id> [--group <group>]
To execute one particular command:
$ ./gemfire http://localhost:7070 list regions { "statusCode": "OK", "result": [ { "id": "test", "groups": [ { "configuration": { "name": "test", "type": "REPLICATE" } } ], "links": { "indexes": "http://localhost:7070/management/v1/regions/test/indexes", "self": "http://localhost:7070/management/v1/regions/test", "list": "http://localhost:7070/management/v1/regions" } } ] }