vFabric GemFire Locator Process

The locator is a vFabric GemFire process that tells new, connecting members where running members are located and provides load balancing for server use.

You can run locators as peer locators, server locators, or both:
  • Peer locators give joining members connection information to members already running in the locator's distributed system.
  • Server locators give clients connection information to servers running in the locator's distributed system. Server locators also monitor server load and send clients to least-loaded servers.

By default, locators run as peer and server locators.

You can run the locator standalone or co-located inside another GemFire process. Running your locators standalone provides the highest reliability and availability of the locator service as a whole.

Locator Configuration and Log Files

Locator configuration and log files have the following properties:
  • Locators are members of the distributed system just like any other member. In terms of mcast-port and locators configuration, a locator should be configured in the same manner as a server. Therefore, if there are two locators in the distributed system, each locator should reference both locators (just like a server member would).
  • You can configure locators by using gemfire.properties or by specifying start-up parameters on the command line. If you are specifying the locator's configuration in a properties file, locators require the same gemfire.properties settings as other members of the distributed system and the same gfsecurity.properties settings if you are using a separate, restricted access security settings file.
    For example, to configure both locators and a multicast port in gemfire.properties:
    locators=host1[port1],host2[port2]
    mcast-port=0

    The same configuration on the command line:

    prompt> gemfire start-locator ... -Dgemfire.locators=host1[port1],host2[port2] 
    -Dgemfire.mcast-port=0
  • There is no cache configuration specific to locators.
  • For logging output, the locator always creates a log file in its working directory. This logging is not configurable.

Run and Manage the Locator

Use the following steps to guidelines to run and manage the locator:
  • Standalone locator. Manage a standalone locator in one of these ways:
    • Use the gemfire command-line utility. See vFabric GemFire Command-Line Utility.

      Example:

      prompt> gemfire start-locator
      ...
      prompt> gemfire stop-locator
      Another example that specifies a port and startup directory:
      prompt> sh gemfire start-locator -port=42500 -dir=/Users/gemfire/locator
      The following command starts locator as part of multiple locators:
      prompt> sh gemfire start-locator -port=42500 -dir=/Users/gemfire/locator1 
      -Dgemfire.locators=localhost[42501],localhost[42502]
    • Run the locator as a managed entity through the com.gemstone.gemfire.admin.AdminDistributedSystem API. To start the locator, call the addLocator method followed by start. Other methods allow you to manage and stop the locator.
  • Co-located locator. Manage a co-located locator at member startup or through the APIs:
    • Use the gemfire.properties start-locator setting to start the locator automatically inside your GemFire member. See gemfire.properties and gfsecurity.properties (vFabric GemFire Property Files). The locator stops automatically when the member exits. The property has the following syntax:
      start-locator=[address]port[,server={true|false},peer={true|false}]

      Example:

      start-locator=13489
    • Use com.gemstone.gemfire.distributed.Locator to start the locator inside your code. The startLocatorAndDS method starts the locator and connects to the distributed system. The startLocator method starts a locator that only provides peer discovery - no server discovery for clients. The other methods provide information and allow you to stop the locator.