Apache Ignite Node.js Thin Client

Clone this repo:

Branches

  1. 76c7d7e IGNITE-11032 Move to TypeScript by Semyon Danilov · 5 months ago master
  2. 01b74ee IGNITE-13794: Partition awareness for Node.js by Semyon Danilov · 5 months ago
  3. 629b7b3 IGNITE-13598: Fix Node.js tests. Set dev deps to fixed versions by Igor Sapego · 8 months ago
  4. c8a89a7 IGNITE-11597 Fix for Node.js thin client UUID marshalling by ekaterina-nbl · 2 years, 1 month ago
  5. 87a0e0e IGNITE-11748: Removed autogenerated Node.js docs by Igor Sapego · 2 years, 2 months ago

NodeJS Client for Apache Ignite

Installation

Node.js version 8 or higher is required. Either download the Node.js pre-built binary for the target platform, or install Node.js via package manager.

Once node and npm are installed, you can use one of the following installation options.

Installation via npm

Execute the following command to install the Node.js Thin Client package:

npm install -g apache-ignite-client

Installation from Sources

If you want to install the Thin Client library from Ignite sources, please follow the steps:

  1. Download Ignite sources to local_ignite_path
  2. Go to local_ignite_path/modules/platforms/nodejs folder
  3. Execute npm link command
  4. Execute npm link apache-ignite-client command (needed only for examples)
cd local_ignite_path/modules/platforms/nodejs
npm link
npm link apache-ignite-client #linking examples (optional)

For more information, see Apache Ignite Node.JS Thin Client documentation.

Tests Installation

Tests are installed along with the client. Follow the Installation instructions.

Tests Running

  1. Run Ignite server locally or remotely with default configuration.
  2. Set the environment variable:
    • APACHE_IGNITE_CLIENT_ENDPOINTS - comma separated list of Ignite node endpoints.
    • APACHE_IGNITE_CLIENT_DEBUG - (optional) if true, tests will display additional output (default: false).
  3. Alternatively, instead of the environment variables setting, you can directly specify the values of the corresponding variables in nodejs-thin-client/spec/config.js file.
  4. Run the tests:

Run Functional Tests

Call npm test command from nodejs-thin-client folder.

Run Examples Executors

Call npm run test:examples command from nodejs-thin-client folder.

Run AuthTlsExample Executor

Active Ignite server node with non-default configuration is required (authentication and TLS switched on).

If the server runs locally:

  • setup the server to accept TLS. During the setup use keystore.jks and truststore.jks certificates from nodejs-thin-client/examples/certs/ folder. Password for the files: 123456
  • switch on the authentication on the server. Use the default username/password.

If the server runs remotely, and/or other certificates are required, and/or non-default username/password is required - see this instruction.

Call npm run test:auth_example command from nodejs-thin-client folder.

Additional Setup for AuthTlsExample

  1. Obtain certificates required for TLS:
  • either use pre-generated certificates provided in the examples/certs folder. Password for the files: 123456. Note, these certificates work for an Ignite server installed locally only.

  • or obtain other existing certificates applicable for a concrete Ignite server.

  • or generate new certificates applicable for a concrete Ignite server.

  • The following files are needed:

    • keystore.jks, truststore.jks - for the server side
    • client.key, client.crt, ca.crt - for the client side
  1. Place client.key, client.crt and ca.crt files somewhere locally, eg. into the examples/certs folder.

  2. If needed, modify TLS_KEY_FILE_NAME, TLS_CERT_FILE_NAME and TLS_CA_FILE_NAME constants in the example source file. The default values point to the files in the examples/certs folder.

  3. Setup Ignite server to accept TLS - see appropriate Ignite documentation. Provide the obtained keystore.jks and truststore.jks certificates during the setup.

  4. Switch on and setup authentication in Ignite server - see appropriate Ignite documentation.

  5. If needed, modify USER_NAME and PASSWORD constants in the example source file. The default values are the default Ignite username/password.

Additional Setup for FailoverExample

  1. Start three Ignite server nodes.

  2. If needed, modify ENDPOINT1, ENDPOINT2, ENDPOINT2 constants in an example source file - Ignite node endpoints. Default values are localhost:10800, localhost:10801, localhost:10802 respectively.

  3. Run an example by calling node FailoverExample.js.

  4. Shut down the node the client is connected to (you can find it out from the client logs in the console).

  5. From the logs, you will see that the client automatically reconnects to another node which is available.

  6. Shut down all the nodes. You will see the client being stopped after failing to connect to each of the nodes.


API spec generation: instruction

It should be done if a public API class/method has been changed.

  1. Execute npm install -g jsdoc to install jsdoc (https://www.npmjs.com/package/jsdoc)
  2. Go to nodejs-thin-client/api_spec
  3. Execute jsdoc -c conf.json --readme index.md command.

Note: nodejs-thin-client/api_spec/conf.json is a file with jsdoc configuration.

For more information, see Ignite Node.js Thin Client documentation.