|Configuring Discovery Mechanisms / 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.
gfxd server start -locators=locator1host,locator2host \ -client-bind-address=server1host -client-port=1529 -dir=server1
gfxd server start -locators=locator1host,locator2host \ -client-bind-address=server2host -client-port=1530 -dir=server2
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.