This topic explains how VMware Tanzu GemFire server discovery works.
Tanzu GemFire locators provide reliable and flexible server discovery services for your clients. You can use all servers for all client requests, or group servers according to function, with the locators directing each client request to the right group of servers.
By default, Tanzu GemFire clients and servers discover each other on a predefined port (40404) on the localhost. This works, but is not typically the way you would deploy a client/server configuration. The recommended solution is to use one or more dedicated locators. A locator provides both discovery and load balancing services. With server locators, clients are configured with a locator list and locators maintain a dynamic server list. The locator listens at an address and port for connecting clients and gives the clients server information. The clients are configured with locator information and have no configuration specific to the servers.
In this figure, only one locator is shown, but the recommended configuration uses multiple locators for high availability.
The locator and servers have the same peer discovery configured in their gemfire.properties
:
locators=lucy[41111]
The servers, run on their respective hosts, have this cache-server
configuration in their cache.xml
:
<cache-server port="40404" ...
The client’s cache.xml
pool
configuration and region-attributes
:
<pool name="PoolA" ...
<locator host="lucy" port="41111">
<region ...
<region-attributes pool-name="PoolA" ...
You can control which servers are used with named member groups. Do this if you want your servers to manage different data sets or to direct specific client traffic to a subset of servers, such as those directly connected to a back-end database.
To split data management between servers, configure some servers to host one set of data regions and some to host another set. Assign the servers to two separate member groups. Then, define two separate server pools on the client side and assign the pools to the proper corresponding client regions.
In this figure, the client use of the regions is also split, but you could have both pools and both regions defined in all of your clients.
This is the gemfire.properties
definition for Server 1:
#gemfire.properties
groups=Portfolios
And the pool
declaration for Client 1:
<pool name="PortfolioPool" server-group="Portfolios"...
<locator host="lucy" port="41111">