Start GemFire XD Peers and Servers Using Locators

GemFire XD peers or servers must specify a list of locator addresses to connect to when they join the distributed system.

Use the -locators option when starting a GemFire XD server or peer to identify the peer connection the member should use to join the distributed system. In the previous section, Start and Stop Locators, two locators were started using the -peer-discovery-address and -peer-discovery-port combinations of "locator1host:10101" and "locator2host:20202." In order to join the distributed system created by these locators, new GemFire XD servers must specify those peer connections at startup.

For example, to start a new GemFire XD server in the same cluster defined in Start and Stop Locators, use the command:
gfxd server start -locators=locator1host[10101],locator2host[20202] \
     -client-bind-address=server1host -client-port=1529 -dir=server1
Any additional servers joining the same cluster would likewise specify the same list of locators:
gfxd server start -locators=locator1host[10101],locator2host[20202] \
     -client-bind-address=server2host -client-port=1530 -dir=server2
Embedded GemFire XD peers can supply the locators attribute in the JDBC peer client connection string. For example:

As each server or peer joins the distributed system, both locators update their information with the new server's client connection information. Note that although each server defines a client bind address and port, individual clients should connect directly to one of the available locators rather than to an individual server. In this way, the locator can load balance client connections to available servers, and can manage the list of available servers as they leave and join the distributed system.