Apache Geode CHANGELOG

connect

Connect to a JMX manager either directly or via a locator.

If you are connecting via a locator, and a JMX manager does not already exist, the locator starts one.

gfsh connects as a discovery client to the locator service and asks where the JMX Manager is. The locator knows when there is no member currently configured as the JMX manager and simply starts up the JMX manager service within itself. gfsh connects as a JMX client to the locator’s JMX RMI port.

You can also connect to a remote locator using the HTTP protocol, as illustrated by the second example below.

Availability: Offline. You will receive a notification “Already connected to: host[port]” if you are already connected.

Syntax:

connect [--locator=value] [--jmx-manager=value] [--use-http(=value)?] [--url=value]
    [--user=value] [--password=value] [--token=value]
    [--key-store=value] [--key-store-password=value]
    [--trust-store=value] [--trust-store-password=value] [--ciphers=value]
    [--protocols=value] [--security-properties-file=value] [--use-ssl(=value)?]
    [--skip-ssl-validation(=value)?]

Table 1. Connect Parameters
Name Description Default
--locator Network address of the Locator in the form: host[port]. localhost[10334]
--jmx-manager Network address of the JMX manager in the form: host[port].  
--use-http Connects to a JMX manager HTTP service using the HTTP protocol.
  • If the parameter is not specified: false
  • If the parameter is specified without a value: true
--url URL used to connect to a JMX manager’s HTTP service http://localhost:8080/gemfire/v1
--user The user name of the credential to use in authentication when connecting to the JMX manager. When specified, if the --password option is not also specified, gfsh will prompt for the password. This option cannot be used with --token.  
--password The password portion of the credential to use in authentication when connecting to the JMX manager. This option cannot be used with --token.  
--token The OAuth token to use in authentication when connecting to the JMX manager. This token will be given to SecurityManager.authenticate on the JMX manager. This option cannot be used with --user or --password.  
--key-store Java keystore file containing this application’s certificate and private key. If the --key-store-password parameter is not specified, gfsh prompts the operator for the password.  
--key-store-password Password to access the private key from the keystore file specified by --key-store.  
--trust-store Java keystore file containing the collection of CA certificates trusted by this application. If the --trust-store-password parameter is not specified, gfsh prompts the operator for the password.  
--trust-store-password Password to unlock the keystore file specified by --trust-store.  
--ciphers SSL/TLS ciphers used when encrypting the connection. The default is “any”.  
--protocols SSL/TLS protocol versions to enable when encrypting the connection. The default is “any”.  
--security-properties-file The gfsecurity.properties file for configuring gfsh to connect to the Locator/Manager. The file path can be absolute or relative to the current gfsh directory.  
--use-ssl Whether to use SSL for communication with Locator and/or JMX Manager. If set to true, the connect command also reads gfsecurity.properties. SSL Options take precedence over values set in the properties file. If none are specified, defaults are used.
  • If the parameter is not specified: false
  • If the parameter is specified without a value: true
--skip-ssl-validation When SSL communication is enabled and this option is specified or assigned the value true, this gfsh client accepts any SSL certificate, allowing this gfsh client to authenticate any locator or server to which it is connecting. This option exists to facilitate testing, and it is not intended for production systems. false

Table 1. Connect Parameters

Example Commands:

If you do not specify a locator or JMX manager, gfsh connects to the locator on the localhost at the default port.

gfsh>connect

Sample Output:

gfsh>connect
Connecting to Locator at [host=localhost, port=10334] ..
Connecting to Manager at [host=GemFireStymon, port=1099] ..
Successfully connected to: [host=GemFireStymon, port=1099]

Example of connecting to a remote locator over HTTP:

gfsh>connect --use-http=true --url="http://myLocatorHost.example.com:8080/gemfire/v1"
Successfully connected to: GemFire Manager's HTTP service @ 
http://myLocatorHost.example.com:8080/gemfire/v1

Error Messages:

"Locator could not find a JMX Manager";
"jmx password must be specified.";
"Could not connect to : {0}. {1}";
"Could not find a GemFire jmx-manager service running at {0}.";
"--token requires a value, for example --token=foo";
"--token cannot be combined with --user or --password";
"Could not connect to GemFire Locator service at {0}."