Connect to a Distributed System Using Locators

GemFire XD thin clients specify the client bind address and port of a locator in order to connect to a GemFire XD cluster.

Connecting to a locator ensures that a client is load-balanced to an available GemFire XD server in the distributed system. If the client's connection to a server is dropped (for example, if the server is shut down), then the client can retry connecting to the same locator to access another available server.

Note: Thin clients do not specify the peer discovery addresses or port as do GemFire XD servers and peers.
For example, in an interactive gfxd session, use the connect client command and specify the client host and port number of a locator:
connect client 'locator1host:1527';

In a third-party JDBC tool, specify the host and port in the JDBC connection string:


Locators balance client requests to all GemFire XD servers available in a cluster, so multiple connection requests to the same locator may result in connections to different servers.

Note: When a client connects to a distributed system using a locator, by default the locator provides the client the hostname of an available datastore. You must ensure that each hostname correctly maps to the IP address for each server (for example, in /etc/hosts). As an alternative, for systems that use only IP addresses you can use the prefer-netserver-ipaddress system property to provide server IP addresses to client connections.
Note: When load balancing is enabled, clients may not be able to connect to a specific server even if they provide that server's unique port number for client connections. If a JDBC client needs to connect to a specific member, set load-balance to "false" in the connection string and specify the connection details for a specific GemFire XD member, rather than a locator. For example:
gfxd> connect client 'server_hostname:server_port/;load-balance=false'