Pivotal Knowledge Base


How to run Pivotal Gemfire native client from NodeJS


Product Version
Pivotal 8.1.x-8.2.x
Pivotal Native Client 8.1.x-8.2.x
node-GemFire Tested v0.1.19
NodeJS Tested v0.10.46
OS Tested CentOS 6.4, CentOS 6.5


This article describes how to use GemFire native client from NodeJS.

GemFire officially supports a GemFire Java client and a C#/C++ GemFire Native Client, but does not provide an official interface for NodeJS. There are, however, some customers who are using NodeJS to develop cross-platform/event-driven, rich web applications who would like to call the GemFire native client library like other NodeJS packages. This article provides a brief guide to using the open-source "node-GemFire" NodeJS package.

Please note that "node-GemFire" is open source software and is not officially supported by Pivotal, though it is created and tested by GemFire team members.



    1. Install NodeJS

      Download NodeJS v0.10.x from the NodeJS official site [1], unzip it and add the following environmental settings into the .bashrc user profile.

      #an Example of NodeJS PATH
      export PATH=$PATH:/home/gpadmin/apps/nodejsclient/node-v0.10.46-linux-x64/bin
    2. Install GemFire Native Client.

      Download the GemFire Native Client 8.1.x Linux Distribution zip file from Pivotal Network [2]. Unzip the file and add the following environmental settings to the .bashrc user profile. For details, please refer to the GemFire documentation [3].

      #an Example of GemFire Native Client Environment Variables
      export GFCPP=/home/gpadmin/apps/NativeClient_Linux_64bit_8100_b6258
      export PATH=$PATH:$GFCPP/bin
    3. Install node-GemFire from the NPM package

      Install the node-GemFire module with the NPM package management tool using the following commands:

      $mkdir /home/gpadmin/apps/nodejsclient/GemFire
      $cd /home/gpadmin/apps/nodejsclient/GemFire
      $NODE_TLS_REJECT_UNAUTHORIZED=0 npm install --save GemFire

      Please note that this step will download a precompiled binary, such as [node-GemFire/0.1.19/GemFire-v0.1.19-node-v11-linux-x64.tar.gz] from the download site[6]. Here, [v11] is the Node ABI version, so please make sure that there is a precompiled build provided at this site with the correct node-GemFire version / NodeJS ABI version/platform. Otherwise, you may see some error when installing this package.

      After installing the node-GemFire module successfully, add the following environment settings to the .bashrc user profile.

      #an Example of node modules


GemFire Native Client properties may be configured using the gfcpp.properties file. Place this file in the current working directory of your node application.

As an example, the following settings will turn on statistics collection, set the log level to "fine", and redirect log output to a file.


You can find a list of the available options for the gfcpp.properties file in the documentation [4].


Now you can run a GemFire client from NodeJS to connect with your existing GemFire cluster.

An example is shown below:

var GemFire = require('GemFire');

var cache = GemFire.getCache();
var region = cache.getRegion('myRegion');

You can find detailed API usage in the node-GemFire documentation [5].

A full NodeJS example:exampleClient.js/ExampleClient.xml is attached for your reference. Following is a screenshot of running this exampleClient.js.

Additional Information

  1. Official node-GemFire repository.
  2. You can also fork node-GemFire and test this module from vagrant file (including GemFire cluster). Please see details in the node-GemFire Readme file.


[1] https://nodejs.org/dist/latest-v0.10.x/

[2] https://network.pivotal.io/products/pivotal-GemFire#/releases/164/file_groups/212

[3] http://gemfire81.docs.pivotal.io/docs-GemFire/gemfire_nativeclient/introduction/install-unix.html

[4] http://gemfire81.docs.pivotal.io/docs-GemFire/gemfire_nativeclient/setting-properties/attributes-gfcpp.html

[5] https://github.com/GemFire/node-GemFire/blob/master/doc/api.md

[6] https://download.pivotal.com.s3.amazonaws.com/



Powered by Zendesk