Geode WAN Example - padogrid/padogrid GitHub Wiki

◀️ Geode perf_test App 🔗 Geode Workspaces on VMs ▶️

Geode/GemFire WAN Example

This article describes a complete set of steps for creating a local WAN environment. We'll create two (2) Geode clusters named ny and ln running on localhost. We'll then configure the ny cluster to replicate transactional data to the ln cluster and run the perf_test apps to generate transactional data.

A complementary bundle that has WAN clusters preconfigured and ready to be run is available in the geode-bundles repo. If you want to skip this article and just run the bundle, then you can install the bundle from a Geode/GemFire workspace as follows.

# To see instructions
show_bundle bundle-geode-1-app-perf_test_wan-cluster-ln-ny

# To install bundle
install_bundle -download -workspace bundle-geode-1-app-perf_test_wan-cluster-ln-ny

The steps we'll take are typical steps that you would take when preparing PadoGrid for your local environment.

  1. Install padogrid
  2. Create Workspace
  3. Create Clusters
  4. Update Configuration Files
  5. Start Clusters
  6. Monitor Clusters
  7. Ingest Data
  8. Tear Down
  9. Summary

1. Create Workspace

You can skip this section if you already have a workspace in which you want to walk through this tutorial.

Let's create a new workspace where we can create and test WAN clusters. Run the create_workspace command which will prompt for Java, Geode, workspace name, default cluster, and VM prompts. Make sure to take the default value of false for the Enable VM? prompt. We'll be running clusters locally on your laptop.

create_workspace -name ws-wan

Make sure to switch workspace into the new workspace you just created.

switch_workspace ws-wan

2. Create Clusters

Create the ny and ln clusters with different locator start port numbers as shown below.

# Create the ny cluster
create_cluster -cluster ny -port 10334

# Create the ln cluster
create_cluster -cluster ln -port 10344

3. Update Configuration Files

Let's now configure the cache.xml files to configure the summary region to replicate over the WAN.

  • perf_test performs transactions on eligibility and profile data and inserts the results in the summary map, which we'll replicate over the WAN.

3.1. ny

To enable WAN gateways, we must first assign a unique number defined by the GemFire property, distributed-system-id to each cluster. This number must in the the range of 1 to 255, inclusive. The GemFire properties are set in the etc/gemfire.properties file.

switch_cluster ny
vi etc/gemfire.properties

In addition to distributed-system-id, we also need to set the remote-locators property to the remote locators that this cluster will connect to. For our example, we set it to the ln locator.

# ny ID
distributed-system-id=1
# ln locator (for multiple locators, separate them with comma)
remote-locators=localhost[10344]

We also need to configure the WAN gateway. This is done in the etc/cache.xml file. Let's configure the ny cluster as the sender as by adding the <gateway-sender> element just below the <cache> element and adding the <region-attributes> element as shown below. It is important that the order of XML elements defined in the cache.xml must be kept in the order they are defined in the schema file.

<cache ...>

    <!-- Gateway sender -->
    <gateway-sender id="ny-to-ln" remote-distributed-system-id="2" parallel="true"
        dispatcher-threads="2" maximum-queue-memory="150" order-policy="partition">
    </gateway-sender>
    ...
    <cache-server port="${geode-addon.server.port}" />
    ...
    
    <region name="summary" refid="PARTITION">
        <region-attributes gateway-sender-ids="ln-to-ny"></region-attributes>
    </region>
    
    ...
    
</cache>

3.2. ln

As with the ny cluster, the ln cluster also requires the unique number set to the distributed-system-id property.

switch_cluster ny
vi etc/gemfire.properties

Set distributed-system-id to 2. Unlike ny, we don't need to set the remote-locators for ln since it will not be sending but receiving data only.

# ln ID
distributed-system-id=2

Let's now configure the WAN gateway for ln.

switch_cluster ln
vi etc/cache.xml

We only need to define it as the receiver as shown below. The start-port and end-port attributes are optional attributes that define the range of TCP ports that the receiver will listen on.

<cache ...>

    <!-- Gateway receiver -->
    <gateway-receiver start-port="50510" end-port="50520">
    </gateway-receiver>
    ...
    <cache-server port="${geode-addon.server.port}" />
    ...
    
</cache>

4. Start Clusters

Let's start both clusters.

start_cluster -cluster ny
start_cluster -cluster ln

5. Monitor Clusters

The clusters can be monitored in a number of ways, i.e., by Pulse, gfsh, VSD, JMX, Grafana, PadoGrid, etc. Let's use Pulse for our example. You can view the gateway sender activities from Pulse. To get the Pulse URLs for both clusters run the following:

show_cluster -long -cluster ny
show_cluster -long -cluster ln

You should see the following URLs from the command outputs.

6. Ingest Data

Let's create and change directory to the perf_test app's bin_sh directory.

create_app
cd_app perf_test; cd bin_sh

The perf_test app has already been properly configured to ingest data into the ny cluster. By default, it connects to the locator at localhost[10334], which is the ny locator in our example.

We first need to ingest data into the eligibility and profile regions before we can perform transactions. Run the following to populate these regions in the ny cluster.

./test_ingestion -run

We are now ready to generate transactional data into the summary region which we have configured to replicate over the WAN. The following command aggregates the eligibiliy and profile regions by the groupNumber field and inserts the GroupSummary objects that contain the aggregation information.

./test_tx -run

From Pulse, you should now see the summary region populated in both clusters. Note that the eligibility and profile regions are only populated in the ny cluster. This is because we have not configured them with the WAN gateway.

7. Teardown

stop_cluster -all -cluster ny
stop_cluster -all -cluster ln

8. Summary

Replicating data over the WAN between Geode/GemFire clusters require the following configurations.

  • Locators (gemfire.properties): The distributed-system-id and remote-locators=localhost properties.
  • Members (cache.xml): The gateway-sender and gateway-receiver elements. The gateway-sender-ids region attribute for each region.

PadoGrid greatly simplifies the configuration steps and running clusters.

9. References

  1. Bundle: WAN, A complete bidirectional WAN example, bundle-geode-1-app-perf_test_wan-cluster-ln-ny.

◀️ Geode perf_test App 🔗 Geode Workspaces on VMs ▶️

⚠️ **GitHub.com Fallback** ⚠️