Skip to main content

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.

You can use this version of gfsh to connect to the JMX manager of Geode version 1.10 or newer. If a command is not supported by the JMX manager to which it is connected, the command will fail with a detailed error message.

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]
[--username=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

NameDescriptionDefault
--locatorNetwork address of the Locator in the form host[port].localhost[10334]
--jmx-managerNetwork address of the JMX manager in the form host[port].
--use-httpDeprecated: inferred by the presence of --url. Connects to a JMX manager HTTP service using the HTTP protocol.
--urlURL used to connect to a JMX manager's HTTP service.
--username, --userThe user name for authentication when connecting to the JMX manager. If specified without --password, gfsh prompts for the password. Cannot be used with --token.
--passwordThe password for authentication when connecting to the JMX manager. Cannot be used with --token.
--tokenOAuth token used for authentication. Passed to SecurityManager.authenticate on the JMX manager. Cannot be used with --user or --password.
--key-storeJava keystore file containing this application's certificate and private key. If --key-store-password is not specified, gfsh prompts for it.
--key-store-passwordPassword to access the private key from the keystore specified by --key-store.
--trust-storeJava keystore file containing trusted CA certificates. If --trust-store-password is not specified, gfsh prompts for it.
--trust-store-passwordPassword to unlock the keystore specified by --trust-store.
--ciphersSSL/TLS ciphers used when encrypting the connection.any
--protocolsSSL/TLS protocol versions to enable when encrypting the connection.any
--security-properties-filePath to gfsecurity.properties for configuring gfsh to connect to the Locator/Manager. Can be absolute or relative to the current gfsh directory.
--use-sslWhether to use SSL for communication with the Locator and/or JMX Manager. If true, the command also reads gfsecurity.properties. SSL options take precedence over values in the properties file.If not specified: false
If specified without a value: true
--skip-ssl-validationWhen SSL is enabled and this option is true, the client accepts any SSL certificate. Intended for testing only, not production.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=GeodeStymon, port=1099] ..
Successfully connected to: [host=GeodeStymon, port=1099]

Example of connecting to a remote locator over HTTP:

gfsh>connect --url="http://myLocatorHost.example.com:8080/geode-mgmt/v1"
Successfully connected to: Geode Manager's HTTP service @
http://myLocatorHost.example.com:8080/geode-mgmt/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 Geode 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 Geode Locator service at {0}."